Click here to Skip to main content
15,912,665 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
How to copy the structure of a table? What is the ddl statement for that? Please tell me.
Posted
Updated 13-Sep-20 20:57pm
v2
Comments
Abhinav S 21-Nov-10 3:22am    
Corrected for grammar.
Sandeep Mewara 21-Nov-10 3:46am    
Not clear.

I'd simply do -
SQL
select * into my_new_table from my_old_table where 1=2


Another way -
SQL
create my_new_table as select * from my_old_table where 1 = 2
 
Share this answer
 
In Oracle you execute dbms_metadata.get_ddl with the right switches.

For SqlServer use the Management Studio. Use the
context menu for the node for the relevant database.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900