March 29, 2011 at 12:01 am
Hi all
i want to create structure of an exixting table without using select into.
whether "create table table_name as select * from old_table" works in sqlserver?
March 29, 2011 at 12:08 am
deepikamm (3/29/2011)
whether "create table table_name as select * from old_table" works in sqlserver?
No. The SQL syntax is SELECT ... INTO. Why do you not want to use that?
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
March 29, 2011 at 12:19 am
i need to do multipe insertions ..is it possible?
March 29, 2011 at 12:36 am
Explain?
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
March 29, 2011 at 12:46 am
You could create the structure with
SELECT TOP 0 * INTO <table> FROM <source>
then perform multiple inserts int the new table
---------------------------------------------
If data can screw you, it will; never assume the data are correct.
March 29, 2011 at 12:51 am
There is a table in our application which contains about 1 crore rows and it refers 5 tables with lakhs of rows..so we have planned to archive some of the rows from that table matching the criteria..we are undergoin a lot of data issuses so we have planned to insert the mismatch rows into another table havin the same structure as that of the problematic table.
March 29, 2011 at 3:25 am
Write the query that returns the mismatched rows, once you're happy it returns the correct data, add the INTO clause.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
March 29, 2011 at 5:34 am
create table structure only using
select * into <newtable> from <oldtable> where 0 = 1
will not create any keys, etc though only table definition
-----------------------------------------------------------------------------------------------------------
"Ya can't make an omelette without breaking just a few eggs" 😉
March 31, 2011 at 12:04 am
thank you guys..!!:)
Viewing 9 posts - 1 through 8 (of 8 total)
You must be logged in to reply to this topic. Login to reply