Bulk Import Sql Server 2005
Hello, I bulk import to a table using the following BULK INSERT dbo.name FROM 'k:\Backup1\name.txt' WITH ( FIELDTERMINATOR = ',', ROWTERMINATOR = '\n' ) GO The first colum of the table is bigint no null. I want to be incremented automatically without changing
the bigint no null. In the txt file what should be the value of this column so that the value of this colum to be the previous value + 1? txt file Name_ID First Last 2,Andrew,Patel 3,George,Walker What character should i put in stead of 2, 3? Thanks in advance,
May 25th, 2011 7:48am
Hi Andrikos,
I think you need to enable "Identity Specification" on the first column of the table to increase the value automatically. By default, the Identity Increment would be set to 1.
Next, please make sure that the first value in the name.txt file is INT type (it does not matter about the value, because the SQL Server would specify the identity automatically).
Then, run the Bulk insert again. NOTE: Please check the Bulk insert statement, and make sure KEEPIDENTITY is not specified.
More detailed inforamtion can be found at,
BULK INSERT (Transact-SQL)
http://msdn.microsoft.com/en-us/library/ms188365(v=SQL.90).aspx
At last, please understand that we are discussing SQL Server Reporting Service in this Forum. I think the problem we are experieicing is a pure SQL Query issue, and I would suggest you ask question to SQL Server Database Engine forum at:
http://social.technet.microsoft.com/Forums/en-US/sqldatabaseengine/threads
Thanks for the understanding.
Eileen
Free Windows Admin Tool Kit Click here and download it now
May 31st, 2011 11:47am