August 17, 2010 at 10:12 pm
I have the notepad data with spaces.
I could not import the data into sql Server 2008.
The data:
1000023 COVERT TERRY
WILLIAM
1
1000028 PHIBBS JOANNE
ESTHER
1
1000034 BRYARS STEPHEN
WENDELL
1
1000048 ROBERTSON EDGAR
CHARLES JR
1
There is 5 columns data, it should divide into 5 columns.
Its giving error while importing into sql server 2008,"The last row in the sampled data is incomplete, the column or the row delimiter may be missing or the text is qualified incorrectly",and also it is not saving in the column format, if create columns also its saving in the one column.
could you please explain how to solve this problem.
thanks®ards.
ARP
August 18, 2010 at 8:51 am
When importing, a new line sequence means a new row. Try stripping the new lines out of any individual columns in your file.
The probability of survival is inversely proportional to the angle of arrival.
August 18, 2010 at 10:14 am
Making a guess at your column widths, I have created the format file SAMPLE_FMT.FMT Please note you will need to add backslash n to the row terminator since it won't display correctly on this site. You can then use OPENROWSET BULK to read the file or modify the statement to insert into a table if required.
SAMPLE_FMT.FMT
7.0
5
1SQLCHAR050""1Col001
2SQLCHAR050""2Col002
3SQLCHAR050""3Col003
4SQLCHAR0200""4Col004
5SQLCHAR08"\r"5Col005
SELECT * FROM OPENROWSET (BULK 'C:\SAMPLE.TXT', FORMATFILE = 'C:\SAMPLE_FMT.FMT') AS Z
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply