Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase «««123

Create Insert for Existing Rows Expand / Collapse
Author
Message
Posted Saturday, October 8, 2011 12:04 PM


Right there with Babe

Right there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with Babe

Group: General Forum Members
Last Login: Tuesday, April 1, 2014 4:01 AM
Points: 734, Visits: 645
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...
Post #1187522
Posted Monday, October 10, 2011 2:53 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Thursday, August 7, 2014 8:44 AM
Points: 203, Visits: 648
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.
Post #1187765
« Prev Topic | Next Topic »

Add to briefcase «««123

Permissions Expand / Collapse