i want to create a new table with the existing design of any another table without copying the data of that table in query analyzer not by enterprise managerselect *
into newtable
from anyanothertable
where 1=0:)|||Be aware that Rudy's technique, while fast, will not copy indexes, triggers, or constraints, or identities.|||is this homework?
You seem to know how to script a table in EM, so why not?|||I would just create a script file for the table and it's indexes, etc. and run it in the new server/database. I would do this creation of the script by right-clicking on "all tasks" -> "generate SQL script" in EM. I would create the script that way because I am too lazy to write it by hand/BOL lookups.|||Hi,
we can get the exact schema of procedures, triggers using sp_helptext [object name] but to get the schema of the existing table we cant use sp_helptext. so you can use the procedure mentioned in the below link to know the DDL of the current table.
http://www.koders.com/sql/fid7D3195CD2CA27581E1073314FF58005D2DA4E82B.aspx?s =datediff
Ex:
The name of the procedure used is sp__revtable
sp__revtable [table_name] will give schema of the table. By using it, you can create the schema for the new table|||thanks i got it|||Hi,
we can get the exact schema of procedures, triggers using sp_helptext [object name] but to get the schema of the existing table we cant use sp_helptext. so you can use the procedure mentioned in the below link to know the DDL of the current table.
http://www.koders.com/sql/fid7D3195CD2CA27581E1073314FF58005D2DA4E82B.aspx?s =datediff
Ex:
The name of the procedure used is sp__revtable
sp__revtable [table_name] will give schema of the table. By using it, you can create the schema for the new table
that proc is for sybase, not sql server. parts of it may work, probably not the whole thing, though.|||that proc is for sybase, not sql server. parts of it may work, probably not the whole thing, though.Oh gee, so you mean that I can't take a control computer from a Toyota and put it into a Lexus?
-PatP
No comments:
Post a Comment