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
 Bulk Insert error

Author  Topic 

Villanuev
Constraint Violating Yak Guru

478 Posts

Posted - 2011-10-18 : 23:15:24
Guys,

I got an error running this sripts with bulk insert.
may i know what cause this error.

Here is my scripts

Bulk Insert #VPTable
From 'C:\Material Planning\VP309130.csv'
With
(
DATAFILETYPE = 'char',
FieldTerminator = ',',
CODEPAGE = 'OEM',
KEEPNULLS,
RowTerminator = '\n', FirstRow = 1)


ERROR

Msg 4861, Level 16, State 1, Line 3
Cannot bulk load because the file "C:\Material Planning\VP309130.csv" could not be opened. Operating system error code 3(The system cannot find the path specified.).

Thanks.

JOV

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2011-10-18 : 23:27:18
is the file in your local PC or the Server ? It need to be residing on the server C:\Material Planning


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

Villanuev
Constraint Violating Yak Guru

478 Posts

Posted - 2011-10-19 : 01:06:11
this was residing to my local drive (C:/).
Go to Top of Page

Villanuev
Constraint Violating Yak Guru

478 Posts

Posted - 2011-10-19 : 01:29:53
Btw, im using to login windows authentication not SQL server authentication. maybe this issue
have a problem and also the folder that pointing to access by bulk insert.
Go to Top of Page

Villanuev
Constraint Violating Yak Guru

478 Posts

Posted - 2011-10-19 : 02:22:15
Solved.

anyway, i have additional query.
I would like to removed this P300-1110- and -U
i will retain only INCREDIBLE. can you please help me to do this in script.

This are the data:

P300-1110-C731-U
P300-1110-INCREDIBLE-U
P300-1710-DROID2GLBL-U
P300-1710-DROID2-U


Thank you in Advance.

jov

Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2011-10-19 : 04:20:19
[code]
where data like '%INCREDIBLE%'
[/code]


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

Villanuev
Constraint Violating Yak Guru

478 Posts

Posted - 2011-10-19 : 04:32:29
I mean how to removed the first 10 char and the last 2 char(-U).


SKU
--------------------
P300-1110-C731-U
P300-1110-INCREDIBLE-U
P300-1710-DEVOUR-U
P300-1710-DROID2-U
P300-4410-THUNDRBLT4G-U
P333-4110-8530-U

result:
-----------------
C731
INCREDIBLE
DEVOUR
DROID2
THUNDRBLT4G
8530

Thanks.
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2011-10-19 : 04:34:17
answered here http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=166894


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

Villanuev
Constraint Violating Yak Guru

478 Posts

Posted - 2011-10-19 : 05:30:22
Thanks.
Go to Top of Page
   

- Advertisement -