How can I create a table from another table without copying any values from the old table?
Answer Posted / 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 |
Post New Answer View All Answers
What are constraints in microsoft sql server?
List the various tools available for performance tuning?
What is the purpose of grouping data in a report?
What is 2nf normalization form?
How to connect php with different port numbers?
Tell me what do you understand by a view? What does the with check option clause for a view do?
What are the 3 types of schema?
What are the rendering extensions of ssrs?
What is the default Port No on which SQL Server listens?
What are the advantages of passing name-value pairs as parameters?
What are advantages of ssrs or why we should use ssrs?
What are horizontal and vertical scaling?
List down some advantages of sql stored procedure?
Write a sql query to delete duplicate records from a table called table1
How to create a simple stored procedure in ms sql server?