My friend Dave recently told me about the "CREATE TABLE ... LIKE " SQL statement. MySql and DB2 both support it, and it's apparently part of the SQL99 spec. It's not supported by T-SQL (SQL Server).
CREATE TABLE LIKE is quick way of cloning the structure of an existing table, including any indexes (but not foreign keys). This can be particularly useful in creating new tables to be added to an existing MERGE table.
mysql> CREATE TABLE log_20041124 LIKE log_20041123;
As far as I know, this will not be supported by T-SQL, despite all the other SQL enhancements in Yukon. You can copy everything except the keys / indexes with "SELECT INTO":
select * into CustomersCopy from Customers where 1 = 0
That copies the structure, but doesn't copy the indexes.
One other trick I learned a bit ago: you can select a table in Enterprise Manager and hit control - c. Then go to notepad / query analyzer / etc. and paste to get the create table statement (with all the indexes and stuff). You can also right click a table in Query Analyzer and select "Script Object To New Window As..." to get a Create statement. Still, none of these offers quite what the CREATE TABLE ... LIKE statement does - script level copy of table scructure and indexes.
Back in June 2003 I posted a wish for wrapping in ASP.NET the Trace stack:
LogParser: a cool tool that supports SQL-like queries against "text-based data such as log files, XML files and CSV files, as well as key data sources on the Windows® operating system such as the Event Log, the Registry, the file system, and Active Directory®." [via MSDN]
We use StarTeam for source control at my work. I'm not a huge StarTeam fan, and I think the compare / merge portion is pretty much unusable. Fortunately, you can pick your own alternative merge and compare utilities. I like WinMerge . Here's how to set it up:
1. Tools / Options / File tab.
2. Check "Merge utility" and "Comparison utility" checkboxes.
3. Browse to WinMergeU.exe
4. Enter the following for merge utility options: /dl "StarTeam Version" /dr "Your Changes" $branchtip $usertip $resultfile
5. Enter the following for comparison utility options: /dl "StarTeam or Older Version" /dr "Your Changes or Newer Version" $file1 $file2
WinMerge command line info: http://winmerge.sourceforge.net/2.2/manual/commandline.html
Araxis Merge integration info for various source control systems: http://www.araxis.com/merge/scm_integration.html
powered by IMHO 1.2
A user executes the following two queries in SQL Server Query Analyzer. Query 1 returns no rows; Query 2 returns one row. Why?
Yesterday evening I wanted to take a quick catnap after dinner. That's not too easy with a 1 year old and a 3 year old who want to play with Dada, but I can sometimes get away with it if I convince them we're playing.
"I'm going to play 'nap on the couch' now. I'm the little baby and you can put me to sleep."
"What will you dream about?" Rosemary, the three year old, asked.
"Um... horsies and monkeys and that kind of stuff," I mumbled as I drifted off.
I woke up about 10 minutes later. I learned to appreciate even tiny doses of sleep when I was in the military.
Rosemary was standing a foot away from me, smiling. "Did your dreams come true?" she asked.
"Um... I don't know... uh..." I was groggy. I rarely remember my dreams, and usually when I do they're utter nonsense. How to answer this one?
"Wait a second, Dada." She scurried out of the room. I glanced around and noticed I was surrounded by a huge pile of stuffed horses - she'd obviously been gathering and arranging them the whole time I slept. When did we get so many stuffed horses? Rosemary returned with her only stuffed monkey, a tiny little sock monkey.
"Did your dreams come true, Dada?" She asked again, expectantly.
Yes, sweet little girl. My dreams have come true.
Simon Willison seems to spell it out the best:
Reading between the lines (which in this case isn't particularly hard), this and this (don't forget to view source) suggest that Google are soon to announce that they won't be calculating PageRank for links with a
rel="nofollow"attribute. Finally, an official way of fighting the economics of comment spam by denying PageRank on user-submitted link content. Sam Ruby points to Mark Pilgrim's prediction that spammers won't care - they'll spam anyway, on the offchance that they hit somewhere undefended. I'm optimistic - if the major weblog (and wiki) vendors get behind this one it could help stem the tide.
This is cool - it lets content link sources control the page rank boost they give to the link target - perfect for comment spam, forum spam, etc. Let's hope that Mark Pilgrim is wrong - if this really does make comment spam ineffective, maybe it will at least slow down a bit.
I'm a fan of the Half-Life thing. I stink at it - unlike my little brother who finished it 4 days after it was released and is now literally lapping me, I'm still slogging through. I play for the love of the game, though, and because I really enjoy the storyline.
Managing a big feed list is a pain in the neck. The weblogs.asp.net group feed continues to add new posters (good), but the only mechanism I've found to add them in RSSBandit (or any of the other aggregators I've used) is to
I needed to copy user permissions between two SQL Server environments; this script did the trick: http://www.sql-server-performance.com/bm_object_permission_scripts.asp
I previously posted [URL's with offsets - www.sample.com/interview.mp3#time=32:05] about how I thought it would be very useful to link to a specific portion of an audio resource. As podcasts get bigger, I see that as a huge usability feature.
I'm happy to see the huge growth of community contributed code - things like RSS.NET, sharpziplib, ftp classes to tide us over 'til .NET 2.0, etc.
One thing that bothers me about it is the namespaces. The .NET System namespaces are beautifully organized, but community / open source code namespaces are an anarchistic babel. Those that originate from a big company usually start with the company name, those that come from larger project usually take the the project's name.
One-off code snips / hobbyist / micro-projects usually contain a random concatenation of some or all of the following words: monkey, alien, squishy, bug, fuzzy, code, util, works, MyNamespace, namespace, ware, example, contrib, and lib: monkeyCode, fuzzyAlienWare, utilLib, bugware, etc. This is the case I'm talking about.
I can sort of see the point of company based or project based namespaces. I don't see any value in random namespace names, though. They don't tell anyone anything, and they look suspect to managers and system admins - "What's this bugworksLib.dll?"
I understand there may be concern about twenty different Community.Network.Ftp namespaces floating around, but .NET is smart enough to figure it out, or at least warn you at compile time.
I'd like to see a community standard best practice for community code namespaces - anything remotely professional would do: Community, Shared, Code, etc.
I got a 30GB MP3 player for Christmas so this Podcasting thing is getting more interesting to me. I'd previously wanted a Podcast feed from the Pitchfork Media MP3 page. I'd even started building an application to build the RSS for me based on Roy Osherove's Site-To-RSS code.