How can I create a table from another table without copying any values from the old table?

Answer Posted / amit kumar sharma

Select * into newTable From oldTable where 1=2

The where condition 1=2 will never get true, so only the
column of table will appear and get copied to newTable.

If we remove the where condition table with data will copy
to newtable.

Is This Answer Correct ?    3 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to delete all rows with truncate table statement in ms sql server?

686


What is merge?

743


Is it possible to call a stored procedure within a stored procedure?

726


What the class forname () does?

709


What is the difference between osql and query analyzer?

723






Explain the relational database management system (rdbms)?

764


What is the difference between local and global temporary tables?

788


Do you know the isolation level that sql server support?

706


How to fetch the next row from a cursor with a "fetch" statement?

791


after migrating the dts packg to ssis by using migrtn wizrd in 2005. iam not able to open ssis pack and getting error. what r those errors? how to resolve?

1856


Differentiate between ms sql server reporting services vs crystal reports?

656


Is it possible to replicate data from sql server to oracle? : sql server replication

745


Can a table be created inside a trigger?

725


What is difference between equi join and inner join?

652


Can we install sql server 2016 on windows 7?

865