Thursday, March 22, 2012

bulk insert syntax error

Hi there !!
I try to bulk insert a table like this:
bulk insert mytable
from 'c:\mysrcfile.csv'
with
(
formatfile = 'c:\temp\bcp5.fmt',
firstrow = 2
)
and I always get :
Server: Msg 156, Level 15, State 1, Line 1
Incorrect syntax near the keyword 'from'.
I try the same thing using an exec statement, and I get the same
error..(sometimes it cannot find the format file despite it is in the
good folder...weird error)
any idea '
thanks a lot !
++
Vince--BEGIN PGP SIGNED MESSAGE--
Hash: SHA1
Should be:
bulk insert 'mytable'
from 'c:\mysrcfile.csv'
... etc. ...
Single quotes around the table name.
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)
--BEGIN PGP SIGNATURE--
Version: PGP for Personal Privacy 5.0
Charset: noconv
iQA/ AwUBQlJQBIechKqOuFEgEQJW1gCgmsfxjrm4vipn
kluJyp0NTmbnHNgAoM9E
70q8ntQYjYA2qSoAvdZhWznS
=/TAl
--END PGP SIGNATURE--
Vince <vincent@. wrote:
> Hi there !!
> I try to bulk insert a table like this:
> bulk insert mytable
> from 'c:\mysrcfile.csv'
> with
> (
> formatfile = 'c:\temp\bcp5.fmt',
> firstrow = 2
> )
> and I always get :
> Server: Msg 156, Level 15, State 1, Line 1
> Incorrect syntax near the keyword 'from'.
> I try the same thing using an exec statement, and I get the same
> error..(sometimes it cannot find the format file despite it is in the
> good folder...weird error)|||Vince
Try
bulk insert databasename.dbo.mytable
from 'c:\mysrcfile.csv'
with
(
formatfile = 'c:\temp\bcp5.fmt',
firstrow = 2
)
"Vince .>" <vincent@.<remove> wrote in message
news:dnj45191do4jhegs41i5po0tnb0bq8v55k@.
4ax.com...
> Hi there !!
> I try to bulk insert a table like this:
> bulk insert mytable
> from 'c:\mysrcfile.csv'
> with
> (
> formatfile = 'c:\temp\bcp5.fmt',
> firstrow = 2
> )
> and I always get :
> Server: Msg 156, Level 15, State 1, Line 1
> Incorrect syntax near the keyword 'from'.
> I try the same thing using an exec statement, and I get the same
> error..(sometimes it cannot find the format file despite it is in the
> good folder...weird error)
> any idea '
>
> thanks a lot !
> ++
> Vince|||thnaks a lot..
but I always get
Server: Msg 156, Level 15, State 1, Line 1
Incorrect syntax near the keyword 'from'.
I gonna restart Query Analyser...(and why not Sql Server Services..)

>Vince
>Try
>bulk insert databasename.dbo.mytable
>from 'c:\mysrcfile.csv'
>with
>(
>formatfile = 'c:\temp\bcp5.fmt',
>firstrow = 2
> )
>

No comments:

Post a Comment