Hi there, i hope you can help me.
I'm using visual basic 6 and sql server 2005, i've made a process that reads a batch of .txt, then after processing the data in those files, certain registries must be inserted in a specific table,but if an error happens then that data have to be discarded.
My problem is this, i want to create a temporal table to process the data, and if no error occurs, i copy that data to the specified table.
So far i'm doing this:
Code:
RegistrosRecordset.Open "CREATE TABLE [#NoPagadosDetalle]([Referencia] [nchar](10) COLLATE Modern_Spanish_CI_AS NOT NULL,[Cuenta] [nchar](18) COLLATE Modern_Spanish_CI_AS NOT NULL,[Sucursal] [nchar](4) COLLATE Modern_Spanish_CI_AS NOT NULL,[TipoCuenta] [nchar](2) COLLATE Modern_Spanish_CI_AS NOT NULL) ON [PRIMARY]", ConexionBD
to create the temporal table(that is the table script in sql s2005), then
Code:
RegistrosRecordset.Open "insert Into #NoPagadosDetalle (Referencia,Cuenta,Sucursal,TipoCuenta,NSS,ImporteAbono,GrupoFamiliar,FechaPago,Motivo,CveSubdelegacion,Archivo) values('" & Mid(registros, 1, 10) & "','" & Mid(registros, 11, 18) & "')", ConexionBD
That is my insert, but i got the following error:
error [Microsoft][SQL Native Client][SQL Server]Invalid object name #NoPagadosDetalle
the weird thing is this, while i'm debuggin it step by step after the error occurs, it works correctly.
Any ideas ?