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
> )
>
Showing posts with label thisbulk. Show all posts
Showing posts with label thisbulk. Show all posts
Thursday, March 22, 2012
Wednesday, March 7, 2012
BULK INSERT and Application role
On a connection I use an application role via command:
sp_setapprole 'AppRole', 'xxxx'
When I use a command like this:
BULK INSERT TableX FROM 'C:\tmp\file.dat' WITH
( FORMATFILE='C:\tmp\file.fmt', ROWS_PER_BATCH=10, TABLOCK )
I got the error:
Msg 4834, Level 16, State 4, Line 4
You do not have permission to use the bulk load statement.
so, I would add bulkadmin permission to my applicatio role.
Is it possible ?The bulkadmin role is a server-level role. Application roles are at the
database level. If you are using SQL Server 2005, you can create a stored
proc where the BULK INSERT is done with elevated privileges and then grant
EXEC to the app role.
Tom
----
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
SQL Server MVP
Toronto, ON Canada
https://mvp.support.microsoft.com/profile/Tom.Moreau
"Max" <Max@.discussions.microsoft.com> wrote in message
news:7167E83B-538F-4D72-BF0D-70F757FC289F@.microsoft.com...
On a connection I use an application role via command:
sp_setapprole 'AppRole', 'xxxx'
When I use a command like this:
BULK INSERT TableX FROM 'C:\tmp\file.dat' WITH
( FORMATFILE='C:\tmp\file.fmt', ROWS_PER_BATCH=10, TABLOCK )
I got the error:
Msg 4834, Level 16, State 4, Line 4
You do not have permission to use the bulk load statement.
so, I would add bulkadmin permission to my applicatio role.
Is it possible ?
sp_setapprole 'AppRole', 'xxxx'
When I use a command like this:
BULK INSERT TableX FROM 'C:\tmp\file.dat' WITH
( FORMATFILE='C:\tmp\file.fmt', ROWS_PER_BATCH=10, TABLOCK )
I got the error:
Msg 4834, Level 16, State 4, Line 4
You do not have permission to use the bulk load statement.
so, I would add bulkadmin permission to my applicatio role.
Is it possible ?The bulkadmin role is a server-level role. Application roles are at the
database level. If you are using SQL Server 2005, you can create a stored
proc where the BULK INSERT is done with elevated privileges and then grant
EXEC to the app role.
Tom
----
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
SQL Server MVP
Toronto, ON Canada
https://mvp.support.microsoft.com/profile/Tom.Moreau
"Max" <Max@.discussions.microsoft.com> wrote in message
news:7167E83B-538F-4D72-BF0D-70F757FC289F@.microsoft.com...
On a connection I use an application role via command:
sp_setapprole 'AppRole', 'xxxx'
When I use a command like this:
BULK INSERT TableX FROM 'C:\tmp\file.dat' WITH
( FORMATFILE='C:\tmp\file.fmt', ROWS_PER_BATCH=10, TABLOCK )
I got the error:
Msg 4834, Level 16, State 4, Line 4
You do not have permission to use the bulk load statement.
so, I would add bulkadmin permission to my applicatio role.
Is it possible ?
Subscribe to:
Posts (Atom)