Click here to hide categories Click here to show left categories

User: Home          welcome : Guest          Log In / Register here     




SQL Server interview questions: - In SQL how to create new table from existing table (with data and without data)?

Using “Select ColumnNames into” syntax we can create copy of existing recordset. Copy includes structure and data both.

Example:

Select * into NewCustomerTable from CustomerTable


For Shallow copy we can do something like this.

Select top 0 * into NewCustomerTable from CustomerTable.


It will just create a new table whose structure will be similar to CustomerTable but records will not get copied.

For technical trainings on various topics like WCF, MVC, Business Intelligence, Design Patterns, WPF, TFS and Basic fundamentals feel free to contact SukeshMarla@Gmail.com or visit www.sukesh-marla.com

For more stuff like this, click here. Subscribe to article updates or follow at twitter @SukeshMarla

Also see SQL Server interview questions video on CTE (Common table expression): -

Helpful Website Url
http://www.questpond.com/
Share this article   |    Print    |    Article read by 4228 times
Author:
Shivprasad koirala Koirala
I am a Microsoft MVP for ASP/ASP.NET and currently a CEO of a small E-learning company in India. We are very much active in making training videos , writing books and corporate trainings. Do visit my site http://www.questpond.com for .NET, C# , design pattern , WCF , Silverlight , LINQ , ASP.NET , ADO.NET , Sharepoint , UML , SQL Server training and Interview questions and answers
Related Articles: No related article
Related Interview Questions: No related interview question