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 |
Difference between DELETE and TRUNCATE?
What is executereader?
How to delete duplicate records from a table?(for suppose in a table we have 1000 Records in that we have 200 duplicate Records , so ,how to findout that duplicate Records , how to delete those Records and arranged into sequence order? one more thing that there is no primary key at all)
What is the Query of getting last 10 transaction Reports (like insert, update, Delete Data from Tabele) ?
how would you improve etl (extract, transform, load) throughput?
What is BCNF? How is it better than 2NF & 3NF?
What are distributed partitioned views?
how do u find least salary in a table
How does index makes search faster?
A left outer join B B right outer join A gives the same result then what is the use of two?
What is ms sql server reporting services?
When we can say that is in BCNF?