Respuesta: como convertir un int a un varchar select 'INSERT INTO [SNT_CONTAB].[dbo].[C01TransThird] ([KeyTrans],[KeyEntry],[siPeriod],[ID_Entry],[ID_Trans],[NLine],[ID_Third],[ID_Account],[Amount],[Cr],[TaxBase],[dtDate],[dtDateTrc],[Reference],[Detail]) Values
('+convert(char,@KeyTrans)+','+convert(char,@KeyEn try)+','+convert(char,@siPeriod)+','+convert(char, @ID_Entry)+','+'1'+','+'1'+','+convert(char,@ID3)+ ','+'418505'+','+convert(varchar,@Descuentos)+','+ '1'+','+'0'+','+convert(varchar,@siPeriod)+'+'+con vert(varchar,@MesConsol)+'+'+convert(varchar,@DiaC onsol_F)+','+convert(varchar,@Fechafac)+','+conver t(varchar,@nrofactura)+','+convert(varchar,@NomCli e)+')' esta es tu instruccion, quieres hacer un insert dentro de un select???
si quieres executar un insert asi como lo estas haciendo seria set @query='INSERT INTO [SNT_CONTAB].[dbo].[C01TransThird] ([KeyTrans],[KeyEntry],[siPeriod],[ID_Entry],[ID_Trans],[NLine],[ID_Third],[ID_Account],[Amount],[Cr],[TaxBase],[dtDate],[dtDateTrc],[Reference],[Detail]) Values
('+convert(char,@KeyTrans)+','+convert(char,@KeyEn try)+','+convert(char,@siPeriod)+','+convert(char, @ID_Entry)+','+'1'+','+'1'+','+convert(char,@ID3)+ ','+'418505'+','+convert(varchar,@Descuentos)+','+ '1'+','+'0'+','+convert(varchar,@siPeriod)+'+'+con vert(varchar,@MesConsol)+'+'+convert(varchar,@DiaC onsol_F)+','+convert(varchar,@Fechafac)+','+conver t(varchar,@nrofactura)+','+convert(varchar,@NomCli e)+')'
exec Sp_sqlExec @query
__________________ What does an execution plan say to t-sql query? Go f**k yourself, if you are not happy with me |