Scenario:
Your new table doesn’t exist, but you have a complicated (or not) TSQL statement that you’d like to run and have it all inserted into a new table.
This is even more simple than you’d ever think. Here’s the basic TSQL you’d run against SQL Server:
Select (List of fields) From MyTable
To create a new table from that Query, all you need to do is add one line in the middle of it:
Select (List of fields) Into MyTableCopy From MyTable
The results from your Select statement would then be entered (data/fields, etc) into a new table called ‘MyTableCopy’ (in this case).
All Things DotNet Discussed – Winforms/ASP.Net/SharePoint/WPF
Leave a reply
You must be logged in to post a comment.