Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


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



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

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

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

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

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

Answer / arun

Select top 0
into newtable
from oldtable

Is This Answer Correct ?    3 Yes 2 No

Post New Answer

More SQL Server Interview Questions

What is the difference between join and inner join?

0 Answers  


Can you explain what are commit and rollback in sql?

0 Answers  


What is the maximum size per database for sql server express?

0 Answers  


What is the difference between count () and rowcount ()?

0 Answers  


What is a performance monitor?

0 Answers  


What are different types of data sources?

0 Answers  


What is the use of floor function in sql server?

0 Answers  


How can you swap values between two rows in a table using single- SQL statement?

1 Answers   Tavant Technologies, Virtusa,


What's the difference between a primary key and a unique key?

4 Answers  


Explain go command in sql server?

0 Answers  


How to filter records of table in SQL SERVER?

0 Answers   Petranics Solutions,


What is the status of services on passive node for failover cluster in sql server? : sql server database administration

0 Answers  


Categories