what the use of into statement in SQL ? [Resolved]

Posted by Gow.Net under Sql Server on 4/28/2012 | Points: 10 | Views : 989 | Status : [Member] | Replies : 2
what the use of into statement in SQL ?

gowthaman8870226416


Responses

Posted by: Pandians on: 4/28/2012 [Member] [MVP] Silver | Points: 50

Up
0
Down

Resolved
Hi

we can use "INTO" statement in various situations...

Normally, when we copy an existing table into an another name.
SELECT * INTO NewTableName FROM ExistingTableName
GO
(or)
Asigning a column value into a variable inside the CURSOR

Note:
1. If you want to copy only the structure then simply include WHERE clause with FALSE condition
SELECT * INTO NewTableName FROM ExistingTableName WHERE 1=0
GO

I hope it would help to proceed further!

Cheers
www.SQLServerbuddy.blogspot.com
iLink Multitech Solutions

Gow.Net, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Muhsinathk on: 6/20/2012 [Member] Bronze | Points: 25

Up
0
Down
The SELECT INTO statement selects data from one table and inserts it into a different table.
The SELECT INTO statement is most often used to create backup copies of tables.

Refer this link
http://msdn.microsoft.com/en-us/library/ms188029(v=sql.110).aspx

Gow.Net, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response