I need to modify a SQL Server Bulk Import SPROC statement slightly and I'm not sure of the syntax.
This is the statement I have used in the past
set @sql = 'Insert into Balance_Import
select * from openrowset( bulk '''+@ImportFileNameAndLoc+''' ,FORMATFILE = '''+@FormatFileNameAndLoc+''') as a'
The variables '@ImportFileNameAndLoc' and '@FormatFileNameAndLoc' are passed to the SPROC as parameters
It worked for file being imported that did not have field names in the first record of the imported file.
The import file I am working with now has field names in the first line so I need to add the Firstrow=2 into the above statement.
How do I revise the original statement to add the 'Firstrow=2'?
If it helps here is the hard coded version of the Bulk import
--Insert into Balance_Import
--select * FROM OPENROWSET( BULK 'I:\My Documents\Access_Databases\JordanDelinq\TestDirectory\Balances\MJOLibrary Summaries_TabDelim.txt', firstrow = 2,
--FORMATFILE = 'I:\My Documents\Access_Databases\JordanDelinq\TestDirectory\SQLImportFormatFiles\Balance_TabDelimited_Import_MArkW01.txt') as a