|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Saturday, January 19, 2013 8:28 AM
Points: 1,038,
Visits: 255
|
|
|
|
|
|
Old Hand
      
Group: General Forum Members
Last Login: Yesterday @ 11:24 AM
Points: 319,
Visits: 728
|
|
I was unaware of the output option for this. I'm not sure I'll ever really need it but it is cool to know I have the option.
Cheers
|
|
|
|
|
SSC-Enthusiastic
      
Group: General Forum Members
Last Login: Thursday, March 21, 2013 3:53 PM
Points: 114,
Visits: 916
|
|
Another useful variation of the INSERT command is the "SIF" format to create a table with fields based on the source table:
SELECT Id, Name, Quantity INTO SomeOtherTable -- Or even @SomeOtherTable FROM Fruit
This will create a table ("SomeOtherTable") with the Id, Name, and Quantity columns from the Fruit table. You can specify a WHERE clause to limit the records you pull out (WHERE Quantity > 2). Useful for on-the-fly requirements to get a subset of records out of a larger table to manipulate or scan through.
|
|
|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Tuesday, February 26, 2013 2:27 PM
Points: 9,
Visits: 15
|
|
Why does the Id column in listing 9 start with 21 after the previous is dropped and the new one is made an identity?
Sorry... newbie here.
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Saturday, January 19, 2013 8:28 AM
Points: 1,038,
Visits: 255
|
|
Very good question. Looks like the article output is incorrect. The id values should be 19 and 20. I'll will get this update. Thank you for pointing this out.
Greg
Gregory A. Larsen, MVP
Need SQL Server Examples check out my website at http://www.sqlserverexamples.com
|
|
|
|