how to create new table which structure should be same as another table
i tried, Create table dom as select * from dom1 where 1=2 but its not working error occured
how to create new table which structure should be same as another table
i tried, Create table dom as select * from dom1 where 1=2 but its not working error occured
Try:
Select * Into <DestinationTableName> From <SourceTableName> Where 1 = 2
Note that this will not copy indexes, keys, etc.
If you want to copy the entire structure, you need to generate a Create Script of the table. You can use that script to create a new table with the same structure. You can then also dump the data into the new table if you need to.
If you are using Enterprise Manager, just right-click the table and select copy to generate a Create Script.
I don't know why you want to do that, but try:
SELECT *
INTO NewTable
FROM OldTable
WHERE 1 = 2
It should work.