Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

Bulk INsert with variable Lastrow

$
0
0

I just cam across this.

http://dbaspot.com/sqlserver-programming/416932-bulk-insert-lastrow-attribute.html


How can I incorporate that into this SQL Script?

DECLARE @fullpath3 NVARCHAR(2000);
DECLARE @FileCount INT;
SET @fullpath3 = N'''\\mx\london-sql\FTP\' + convert(varchar, getdate()-1, 112) + '_SPBMI_GL_PROP_USD_C_ADJ.SPC'''
declare @cmd3 nvarchar(1000)
select @cmd3 = 'bulk insert [dbo].[SPBMI_GL_PROP_USD_C_ADJ_Daily] from ' + @fullpath3 + ' with (FIELDTERMINATOR = ''\t'', FIRSTROW = 2, LASTROW = ' + CAST(@FileCount AS NVARCHAR(10)), ROWTERMINATOR=''0x0a'')';';
exec (@fullpath3);
It seems like I'm missing some kind of special chanracter, or concatenation operator, or linefeed...or some such thing


Knowledge is the only thing that I can give you, and still retain, and we are both better off for it.


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>