First Data Row (Model Object)
Applies to
Platform: Microsoft SQL Server
Architecture: Stage
First Data Row (FirstDataRow) is the number of the first row of a source file that the raw data loader reads as data. The loader passes it to the FIRSTROW argument of OPENROWSET, so rows above it, such as a header row, are skipped.
The property exists only in the Microsoft SQL Server Stage File generator. There, the raw data loader is the procedure that reads the files of a Stage into its raw data table.
Where to set it
Set First Data Row when you edit a model object of type Source. It is a text field that takes a whole number. Every Stage that reads the Source uses the same value.
Values
2: skips one header row.1: reads every row, for files without a header row.- Another number: skips the rows above it.
- Empty: the loader omits
FIRSTROW. SQL Server then starts at row 1, and a header row is loaded as a data row.
SQL Server counts rows by their row terminators, as described in the Microsoft documentation of OPENROWSET BULK.
Default value
2.
Example
The file CUSTOMER.csv has a header row and one data row:
CUSTOMER_ID|CUSTOMER|CUSTOMER_TYPE|... 10|Müller AG|B|...
With First Data Row 2, the raw data loader reads the file with ,FIRSTROW = 2 and stores one row with CUSTOMER_ID 10. With an empty value, it stores two rows: the first holds the column names as values, for example CUSTOMER_ID in the column CUSTOMER_ID.
Related articles
- Reference: Code Page (Model Object), Row Delimiter (Model Object)
- See also: Model a Stage File Solution, Microsoft SQL Server - Stage Files