Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Wordpad to SQL server

Author  Topic 

raysefo
Constraint Violating Yak Guru

260 Posts

Posted - 2006-06-11 : 14:02:48
Hi,

i have a very huge data (with 7 columns) on wordpad and i wanna import this into my sql server. Would you please help me?

thanks

nr
SQLTeam MVY

12543 Posts

Posted - 2006-06-11 : 14:33:46
Save it as csv and bulk insert it?

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

raysefo
Constraint Violating Yak Guru

260 Posts

Posted - 2006-06-12 : 09:39:29
Hi,

i tried to bulk insert the csv file as written below;

BULK INSERT OrdersBulk
FROM 'c:\file.csv'
WITH
(
FIRSTROW = 2,
FIELDTERMINATOR = ',',
ROWTERMINATOR = '\n'
)
But unfortunately gave this error,
Server: Msg 2775, Level 16, State 1, Line 1
Code page 857 is not supported by the operating system.
The statement has been terminated.
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2006-06-12 : 11:03:54
Where did the file originate from? And what's the format of the file?



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam
Go to Top of Page

raysefo
Constraint Violating Yak Guru

260 Posts

Posted - 2006-06-12 : 11:16:53
Its Microsoft Excel Comma Separated Values File and came from UK!
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2006-06-12 : 11:30:06
Whn I said originate, I didn't mean what country...but what platform

Sounds like a Win o/s in any case

What happens if you try and DTS the file into a new table?

Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam
Go to Top of Page

Arnold Fribble
Yak-finder General

1961 Posts

Posted - 2006-06-12 : 12:19:42
It's probably the funny OEM default for input file codepage in BULK INSERT that's a problem. Use:
CODEPAGE = 'ACP'

Even so, if it's csv output from Excel, you'll probably have problems with the field quoting and quote escaping. BULK INSERT doesn't have any mechanism for handling them.
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2006-06-12 : 12:56:53
maybe bcp is a better option....

Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam
Go to Top of Page
   

- Advertisement -