web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :

SQL Snippets: SELECT INTO

Ian Grieve Profile Picture Ian Grieve 22,784
Microsoft SQL ServerThis post is part of the series on SQL Snippets.

I occasionally need to make a backup of a SQL table and all rows within; while you can create a table and insert the content, this is the long way of doing. Instead you can use SELECT INTO to both create a table with the correct columns and also to copy the data.

In the below example I am creating a new table suffixed with the date; the first highlighted section is the new destination table to be created and the second the source table:

SELECT *
INTO IV00101_20210910
FROM IV00101

Read original post SQL Snippets: SELECT INTO at azurecurve|Ramblings of an IT Professional


This was originally posted here.

Comments

*This post is locked for comments