|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Bulk insert
I need to upload data into my database.I'm using bulk insert to do that.My data is stored as a text file and I use the following code -
Code:
BULK INSERT KRA_PERS_DTL FROM 'C:/DATA.TXT' WITH ( FIELDTERMINATOR = ',' , ROWTERMINATOR = '\n' , KEEPNULLS ) The problem I am facing is the order.My data is sorted according to the employee code in my text file.However when I perform a bulk insert it is causing a problem, i.e the sort order is lost.I am doing bulk inser in batches since I have about 500 records.Any help would be greatly appreciated! |
|
#2
|
|||
|
|||
|
Unless you have a clustered index on your table, there is no such thing as "sort order." in sql you need to specify the order of your result set by using the "ORDER BY" clause.
|
|
#3
|
|||
|
|||
|
Quote:
I added a clustered index and fixed it up.Thanks a lot! |
![]() |
| Viewing: ASP Free Forums > Database > Microsoft SQL Server > Bulk insert |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|