How can I create a table from another table without copying any values from the old table?
Answers were Sorted based on User's Feedback
Answer / mohammadali.info
CREATE TABLE new_table
AS (SELECT * FROM old_table WHERE 1=2);
For example:
CREATE TABLE suppliers
AS (SELECT * FROM companies WHERE 1=2);
This would create a new table called suppliers that included all columns from the companies table, but no data from the companies table.
Is This Answer Correct ? | 7 Yes | 3 No |
Answer / 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 |
Can we rewrite subqueries into simple select statements or with joins? Example?
How do you implement one-to-one, one-to-many and many-to- many relationships while designing tables?
4 Answers Credit Suisse, GCU, Symphony, TCS,
How to specify the collation for a character data type in ms sql server?
What do you mean by authentication modes in sql server?
create index a on employee(dno) In this,which index was created?
in a table is b in column k (manikanta,sivananda,muralidhar) i want result like (mnikanta,sivnanda,murlidhar) please slove it
Tell me about pre-defined functions of sql?
How many partitions a clustered index has by default in sql server 2012?
What does asynchronous call backs means?
How to delete a database in ms sql server?
how many layers of tcp/ip protocol combined of? : Sql server database administration
How to enter unicode character string literals in ms sql server?