SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Create Insert for Existing Rows


Create Insert for Existing Rows

Author
Message
EvilPostIT
EvilPostIT
SSC Eights!
SSC Eights! (832 reputation)SSC Eights! (832 reputation)SSC Eights! (832 reputation)SSC Eights! (832 reputation)SSC Eights! (832 reputation)SSC Eights! (832 reputation)SSC Eights! (832 reputation)SSC Eights! (832 reputation)

Group: General Forum Members
Points: 832 Visits: 648
It would be possible to do this as a set based operations if you built an sp on the fly and then executed it.



Nuke the site from orbit, its the only way to be sure... w00t
b3yond
b3yond
SSC Veteran
SSC Veteran (217 reputation)SSC Veteran (217 reputation)SSC Veteran (217 reputation)SSC Veteran (217 reputation)SSC Veteran (217 reputation)SSC Veteran (217 reputation)SSC Veteran (217 reputation)SSC Veteran (217 reputation)

Group: General Forum Members
Points: 217 Visits: 770
ron.mcdowell,

I've set @Cmd to NVARCHAR(MAX), the limitations of sp_executesql are only that of server memory or 2GB.

The number of rows is irrelevant as the @Cmd value only has the column list and makeup for extracting the column values. E.g.

SELECT 'INSERT INTO dbo.MyTable (Col1, Col2, Col3) VALUES (' + Col1+ ', ' + Col2 + ', ' + Col3 + ')'
FROM dbo.MyTable

Providing this fits into @Cmd there is no limitation, the actual values are no set in @Cmd.

Hopefully that makes sense.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search