So I have the following query that transfters the data from one table in DB1 to another table in DB2.
DB1 Table: tblSupportAttachments
DB2 Table: tblSupportAttachments
/* tblSupportAttachments */
SET @Sql = N'
INSERT INTO tblSupportAttachments
( fldName ,
fldExtension ,
fldFile ,
fldCreatedBy ,
fldCreatedDate ,
fldSupportId
)
SELECT fldName ,
fldExtension ,
fldFile ,
fldCreatedBy ,
fldCreatedDate ,
fldSupportId
FROM ' + @SourceDB + '.tblSupportAttachments';
EXECUTE sp_executesql @Sql;
fldFile: is of type varbinary(MAX)
This table basically holds data about a particular file, the file is directly uploaded to teh database i the fldFile field it could be a pdf, zip file or whatever
When I try to transfer this data to another table in another database I get the following error:
OLE DB provider "SQLNCLI11" for linked server "10.0.88.99" returned message "Memory allocation failure". Msg 7330, Level 16, State 2, Line 2 Cannot fetch a row from OLE DB provider "SQLNCLI11" for linked server "10.0.88.99".
Does anyone know why this happens?
When I use the Generate Script feature I get the following error:
Microsoft.SqlServer.Management.SqlScriptPublish.SqlScriptPublishException: An error occurred while scripting the objects. ---> System.InvalidOperationException: Internal connection fatal error. at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) at System.Data.SqlClient.TdsParser.ProcessAttention(TdsParserStateObject stateObj) at System.Data.SqlClient.TdsParserStateObject.ResetCancelAndProcessAttention() at System.Data.SqlClient.TdsParserStateObject.CloseSession() at System.Data.SqlClient.SqlDataReader.TryCloseInternal(Boolean closeReader) at System.Data.SqlClient.SqlDataReader.Close() at Microsoft.SqlServer.Management.Smo.DataEnumerator.CleanUp() at Microsoft.SqlServer.Management.Smo.DataEnumerator.Dispose() at Microsoft.SqlServer.Management.Smo.SingleFileWriter.ScriptData(IEnumerable
1 dataScript, Urn table) at Microsoft.SqlServer.Management.Smo.ScriptMaker.ScriptDataToWriter(IEnumerable
1 dataScripts, Urn urn) at Microsoft.SqlServer.Management.Smo.ScriptMaker.ScriptCreateSpecialUrn(Urn urn, ScriptingPreferences sp, ObjectScriptingType& scriptType) at Microsoft.SqlServer.Management.Smo.ScriptMaker.ScriptCreate(Urn urn, ScriptingPreferences sp, ObjectScriptingType& scriptType) at Microsoft.SqlServer.Management.Smo.ScriptMaker.ScriptCreateObjects(IEnumerable1 urns) at Microsoft.SqlServer.Management.Smo.ScriptMaker.ScriptUrns(List
1 orderedUrns) at Microsoft.SqlServer.Management.Smo.ScriptMaker.DiscoverOrderScript(IEnumerable1 urns) at Microsoft.SqlServer.Management.Smo.ScriptMaker.ScriptWorker(List
1 urns, ISmoScriptWriter writer) at Microsoft.SqlServer.Management.Smo.ScriptMaker.Script(Urn[] urns, ISmoScriptWriter writer) at Microsoft.SqlServer.Management.SqlScriptPublish.SqlScriptGenerator.DoScript(ScriptOutputOptions outputOptions) --- End of inner exception stack trace --- at Microsoft.SqlServer.Management.SqlScriptPublish.GeneratePublishPage.worker_DoWork(Object sender, DoWorkEventArgs e) at System.ComponentModel.BackgroundWorker.OnDoWork(DoWorkEventArgs e) at System.ComponentModel.BackgroundWorker.WorkerThreadStart(Object argument)