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 08, 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: Wednesday, February 20, 2013 1:35 AM
Points: 734, Visits: 636
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-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Tuesday, May 07, 2013 4:05 AM
Points: 199, Visits: 498
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