I have a ZIP table with Zip_Code, Zip_City, Zip_State and the text file has the fields in Zip_City, Zip_State, Zip_Code. The instructions were to keep the order as defined in the Entity Definition which would be the first order.
My code for the bulk insert is usually
Code: ( text )
- BULK INSERT DB2914.dbo.[ZIP] FROM 'C:\Documents and Settings\Jthep\My Documents\SQL Server Management Studio\Projects\S2914-HW3\ZIP_data.txt'WITH (FIELDTERMINATOR = ',', ROWTERMINATOR = '\n')
Is there a way to format the columns so I can actually set any column in the text file to any column in the table using Bulk Insert?You can insert into a temp table first and map as you wish...
Good Luck.|||Thanks, I figured I couldnt do it using bulk insert unless I created a temp. However, I'm now allowed to create the table with attributes of the same order as the data in the text file as many of my classmates were asking the professor about it. =D
No comments:
Post a Comment