Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 creating new talbe with existing table schema

Author  Topic 

rafeequddin_ahmed
Starting Member

23 Posts

Posted - 2008-11-14 : 06:02:48
HI All,
I have been asked in interview to write query to creat new table Emp1 from Emp table with schema only (without Emp table Data)

PeterNeo
Constraint Violating Yak Guru

357 Posts

Posted - 2008-11-14 : 06:15:57
[code]SELECT * INTO dbo.Emp1 FROM Emp WHERE 1 = 0[/code]

[code]"There is only one difference between a dream and an aim. A dream requires soundless sleep to see, whereas an aim requires sleepless efforts to achieve..!!"
[/code]
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-11-14 : 07:22:31
or
SELECT TOP 0 * INTO dbo.Emp1 FROM Emp
Go to Top of Page
   

- Advertisement -