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 |
If we shrink the Databse and Files, how much size is decreased?
What is a sub-query? When would you use one?
What is the maximum size of a dimension? : sql server analysis services, ssas
What do you mean by COLLATION?
How many databases instances are there in sql server 2000?
I have a table EMP in which the values will be like this EmpId Ename Sal DeptId 11 Ram 10000 10 11 Ram 10000 10 22 Raj 20000 20 22 Raj 20000 20 33 Anil 15000 30 33 Anil 15000 30 I want to delete only duplicate Rows. After Delete I want the output like this EmpId Ename Sal DeptId 11 Ram 10000 10 22 Raj 20000 20 33 Anil 15000 30
Is mysql better than sql server?
What are the difference between clustered and a non-clustered index?
What does it mean to have quoted_identifier on? What are the implications of having it off?
What are trace flags?
what is lazy writer?
How do I partition a table in sql server?