Al querer hacer un bulk desde una variable me sale estos errores:
(0 rows affected)
Msg 4832, Level 16, State 1, Line 57
Bulk load: An unexpected end of file was encountered in the data file.
Msg 7399, Level 16, State 1, Line 57
The OLE DB provider "BULK" for linked server "(null)" reported an error. The provider did not give any information about the error.
Msg 7330, Level 16, State 2, Line 57
Cannot fetch a row from OLE DB provider "BULK" for linked server "(null)".
Este es mi código:
Alter PROCEDURE SPI_Archivos
@filePath VARCHAR(MAX)
AS
BEGIN
DROP TABLE TempTableBalanza
Create Table TempTableBalanza(
Cuenta nvarchar(max),
Nombre nvarchar(max),
Monto nvarchar(max),
Fecha nvarchar(max),
Clasificación nvarchar(max)
)
DECLARE @sql NVARCHAR(4000) = 'BULK INSERT TempTableBalanza FROM ''' + @filePath + ''' WITH ( FIELDTERMINATOR ='','', ROWTERMINATOR =''\n'', Lastrow = 30000003)';
select * from TempTableBalanza
EXEC(@sql);
--EXEC SP_executesql @SQL
END
Mi archivo es un txt delimitado por tabulaciones.
Espero que me puedan ayudar :c
Gracias de antemano.