显示标签为“system”的博文。显示所有博文
显示标签为“system”的博文。显示所有博文

2012年3月27日星期二

bcp without sqlserver client

Is there any way to make bcp executable work on a pc without having
sqlserver client on that system.does copying any dll's and executables help
thanks a lot for help.
iYou just need to copy the Bulk Copy Program to the client that needs to run it...

2012年3月25日星期日

BCP Syntax

Please I need some help with bcp syntax. I have the default installation of SQL Express on my system. Also, I'm using windows authentication. Here are some syntax tried:

bcp database.dbo.table out "c:\table.dat" -U? -P? -c

I'm not sure what the user name and password should be but I've tried my windows user id and password without any success.

bcp database.dbo.table out "c:\table.dat" -T -c

I'm not sure if this is a trusted connection,

Do I have to be in App_data directory where my database reside.

There are 2 authentication modes that bcp supports:

a) SQL Server authentication in which case you have to specify your SQL Server login and password, say your SQL Server login ID is foo and password is bar then you should specify -Ufoo -Pbar.

b) If you can login to SQL Server using Windows authentication, then just specify -T and it will used Trusted connection.

Thanks

2012年3月22日星期四

BCP SQLSTATE = S1010

Good afternoon.
I have encountered an error in BCP that I originally never had. I have
not made any changes to the system, however, the BCP utility fails.
I am running the following statement:
bcp "Select * from Database..View" queryout "C:\Export\infile.txt" -U
user -P Password -f "C:\Formatfile\infile.fmt"
Resulting in the following error:
SQLSTATE = S1010, Native Error = 0
Error = [Microsoft][ODBC SQL Server Driver]Function Sequence Error
Background Info:
SQL Server 2000 SP3 (8.00.818)
Thanks!
Nathan
Hi Nathan,
Are other users modifying data when you execute the bcp command ?
If so, then there may be a Deadlock scenario and to over come it, just try
doing an Uncommited read in the BCP command, by adding "with (Nolock)" in
the select statement.
HTH
Ashish
This posting is provided "AS IS" with no warranties, and confers no rights.
sql

BCP SQLSTATE = S1010

Good afternoon.
I have encountered an error in BCP that I originally never had. I have
not made any changes to the system, however, the BCP utility fails.
I am running the following statement:
bcp "Select * from Database..View" queryout "C:\Export\infile.txt" -U
user -P Password -f "C:\Formatfile\infile.fmt"
Resulting in the following error:
SQLSTATE = S1010, Native Error = 0
Error = [Microsoft][ODBC SQL Server Driver]Function Sequence Error
Background Info:
SQL Server 2000 SP3 (8.00.818)
Thanks!
NathanHi Nathan,
Are other users modifying data when you execute the bcp command ?
If so, then there may be a Deadlock scenario and to over come it, just try
doing an Uncommited read in the BCP command, by adding "with (Nolock)" in
the select statement.
HTH
Ashish
This posting is provided "AS IS" with no warranties, and confers no rights.

BCP SQLSTATE = S1010

Good afternoon.
I have encountered an error in BCP that I originally never had. I have
not made any changes to the system, however, the BCP utility fails.
I am running the following statement:
bcp "Select * from Database..View" queryout "C:\Export\infile.txt" -U
user -P Password -f "C:\Formatfile\infile.fmt"
Resulting in the following error:
SQLSTATE = S1010, Native Error = 0
Error = [Microsoft][ODBC SQL Server Driver]Function Sequence Error
Background Info:
SQL Server 2000 SP3 (8.00.818)
Thanks!
NathanHi Nathan,
Are other users modifying data when you execute the bcp command ?
If so, then there may be a Deadlock scenario and to over come it, just try
doing an Uncommited read in the BCP command, by adding "with (Nolock)" in
the select statement.
HTH
Ashish
This posting is provided "AS IS" with no warranties, and confers no rights.

BCP Slower Standalone vs. A/P Cluster

I have an issue with the BCP util, it is extremely slow when running a BCP in to the same database on an A/P cluster vs. Standalone system. It is a vendor application, so I have little control as to what I can do. The BCP runs from a jobserver (remote) through the network, but it runs the same way in the standalone system, yet the process is about 10X as slow with the cluster, and the only diff is cluster vs. standalone.

SQLClusterName is specified in -S, not the active node, and it uses a trusted connection, not a local account. Is there anything about a cluster config that would cause the BCP to run slower ?

Any thoughts ??

Thanks,
PaulTry to add "-a32764" and see if that makes a difference.|||Thanks, but I also found out that the Cognos Jobserver (where BCP command is running from) is on a diff subnet than the sql cluster (data is going through a router) On the current standalone config, the jobserver and sqlserver are on the same subnet, also there are NETWORKIO status' for the BCP sessions when the Cognos publish is running, which may indicate a network problem.

Thanks,
Paul|||Thanks, did some initial testing with a 135K row sample, sped it up 5 fold, I am going to see if vendor can add this param to their gen'd BCPs.

Thanks Again,
Paul

2012年3月20日星期二

bcp permissions for non SA

A few years ago I had to enable users to use bcp. I recall that I had to go
in and set the proxy account via the Job System tab of the SQL Server Agent.
I thought that was ALL I had to do. But now it appears as though I need to
grant them exec rights on xp_cmdshell itself? That sucks for obvious reasons.
Is there a way around it? I really dont recall having to do that, but as
mentioned it was years ago.
TIA,
ChrisR
Chris,
Try BULK INSERT.
HTH
Jerry
"ChrisR" <ChrisR@.discussions.microsoft.com> wrote in message
news:A86E8074-8781-4EF2-BA84-D566C7663BB4@.microsoft.com...
>A few years ago I had to enable users to use bcp. I recall that I had to go
> in and set the proxy account via the Job System tab of the SQL Server
> Agent.
> I thought that was ALL I had to do. But now it appears as though I need to
> grant them exec rights on xp_cmdshell itself? That sucks for obvious
> reasons.
> Is there a way around it? I really dont recall having to do that, but as
> mentioned it was years ago.
> --
> TIA,
> ChrisR
sql

bcp permissions for non SA

A few years ago I had to enable users to use bcp. I recall that I had to go
in and set the proxy account via the Job System tab of the SQL Server Agent.
I thought that was ALL I had to do. But now it appears as though I need to
grant them exec rights on xp_cmdshell itself? That sucks for obvious reasons.
Is there a way around it? I really dont recall having to do that, but as
mentioned it was years ago.
--
TIA,
ChrisRChris,
Try BULK INSERT.
HTH
Jerry
"ChrisR" <ChrisR@.discussions.microsoft.com> wrote in message
news:A86E8074-8781-4EF2-BA84-D566C7663BB4@.microsoft.com...
>A few years ago I had to enable users to use bcp. I recall that I had to go
> in and set the proxy account via the Job System tab of the SQL Server
> Agent.
> I thought that was ALL I had to do. But now it appears as though I need to
> grant them exec rights on xp_cmdshell itself? That sucks for obvious
> reasons.
> Is there a way around it? I really dont recall having to do that, but as
> mentioned it was years ago.
> --
> TIA,
> ChrisR

bcp permissions for non SA

A few years ago I had to enable users to use bcp. I recall that I had to go
in and set the proxy account via the Job System tab of the SQL Server Agent.
I thought that was ALL I had to do. But now it appears as though I need to
grant them exec rights on xp_cmdshell itself? That sucks for obvious reasons
.
Is there a way around it? I really dont recall having to do that, but as
mentioned it was years ago.
--
TIA,
ChrisRChris,
Try BULK INSERT.
HTH
Jerry
"ChrisR" <ChrisR@.discussions.microsoft.com> wrote in message
news:A86E8074-8781-4EF2-BA84-D566C7663BB4@.microsoft.com...
>A few years ago I had to enable users to use bcp. I recall that I had to go
> in and set the proxy account via the Job System tab of the SQL Server
> Agent.
> I thought that was ALL I had to do. But now it appears as though I need to
> grant them exec rights on xp_cmdshell itself? That sucks for obvious
> reasons.
> Is there a way around it? I really dont recall having to do that, but as
> mentioned it was years ago.
> --
> TIA,
> ChrisR

2012年3月19日星期一

bcp invalid date format

Hi,
I have problem in BCP utility while exporting data to sql server.
It works in my system and my friend's system , but it gives the
following when its run in production
server.
SQLState = 22007, NativeError = 0
Error = [Microsoft][SQL Native Client]Invalid date format
SQLState = 22007, NativeError = 0
Error = [Microsoft][SQL Native Client]Invalid date format
SQLState = 22007, NativeError = 0
Error = [Microsoft][SQL Native Client]Invalid date format
SQLState = 22007, NativeError = 0
Error = [Microsoft][SQL Native Client]Invalid date format
SQLState = 22007, NativeError = 0
Error = [Microsoft][SQL Native Client]Invalid date format
SQLState = 22007, NativeError = 0
Error = [Microsoft][SQL Native Client]Invalid date format
SQLState = 22007, NativeError = 0
Error = [Microsoft][SQL Native Client]Invalid date format
SQLState = 22007, NativeError = 0
Error = [Microsoft][SQL Native Client]Invalid date format
SQLState = 22007, NativeError = 0
Error = [Microsoft][SQL Native Client]Invalid date format
SQLState = 22007, NativeError = 0
Error = [Microsoft][SQL Native Client]Invalid date format
BCP copy in failed
there are about 365000 records in the data file...
the date values go like below;
5/30/2007 9:27:35 AM
5/30/2007 9:28:37 AM
5/30/2007 5:28:16 PM
5/30/2007 5:28:32 PM
5/30/2007 5:28:16 PM
please help me for this problem...
thanks,
ThiruHi
/*
Kelly,Reynold,kelly@.reynold.com,5/30/2007 9:27:35 AM
John,Smith,bill@.smith.com,5/30/2007 9:27:35 AM
Sara,Parker,sara@.parker.com,5/30/2007 9:27:35 AM
*/
Make a column for dates as VARCHAR(50) and try insert
CREATE TABLE Tmp
(
stFName varchar (50) NOT NULL,
stLName varchar (50) NOT NULL,
stEmail varchar (100) NOT NULL,
dt varchar (100)
)
BULK INSERT tmp FROM 'c:\myfile.txt' WITH (FIELDTERMINATOR = ',')
SELECT * FROM Tmp
Later on you can convert VARCHAR to DATETIME datatype
"Thiru.net" <thirudotnet@.gmail.com> wrote in message
news:1193915642.828573.240090@.q5g2000prf.googlegroups.com...
> Hi,
> I have problem in BCP utility while exporting data to sql server.
> It works in my system and my friend's system , but it gives the
> following when its run in production
> server.
> SQLState = 22007, NativeError = 0
> Error = [Microsoft][SQL Native Client]Invalid date format
> SQLState = 22007, NativeError = 0
> Error = [Microsoft][SQL Native Client]Invalid date format
> SQLState = 22007, NativeError = 0
> Error = [Microsoft][SQL Native Client]Invalid date format
> SQLState = 22007, NativeError = 0
> Error = [Microsoft][SQL Native Client]Invalid date format
> SQLState = 22007, NativeError = 0
> Error = [Microsoft][SQL Native Client]Invalid date format
> SQLState = 22007, NativeError = 0
> Error = [Microsoft][SQL Native Client]Invalid date format
> SQLState = 22007, NativeError = 0
> Error = [Microsoft][SQL Native Client]Invalid date format
> SQLState = 22007, NativeError = 0
> Error = [Microsoft][SQL Native Client]Invalid date format
> SQLState = 22007, NativeError = 0
> Error = [Microsoft][SQL Native Client]Invalid date format
> SQLState = 22007, NativeError = 0
> Error = [Microsoft][SQL Native Client]Invalid date format
> BCP copy in failed
> there are about 365000 records in the data file...
> the date values go like below;
> 5/30/2007 9:27:35 AM
> 5/30/2007 9:28:37 AM
> 5/30/2007 5:28:16 PM
> 5/30/2007 5:28:32 PM
> 5/30/2007 5:28:16 PM
> please help me for this problem...
> thanks,
> Thiru
>|||On Nov 1, 4:47 pm, "Uri Dimant" <u...@.iscar.co.il> wrote:
> Hi
> /*
> Kelly,Reynold,ke...@.reynold.com,5/30/2007 9:27:35 AM
> John,Smith,b...@.smith.com,5/30/2007 9:27:35 AM
> Sara,Parker,s...@.parker.com,5/30/2007 9:27:35 AM
> */
> Make a column for dates as VARCHAR(50) and try insert
> CREATE TABLE Tmp
> (
> stFName varchar (50) NOT NULL,
> stLName varchar (50) NOT NULL,
> stEmail varchar (100) NOT NULL,
> dt varchar (100)
> )
> BULK INSERT tmp FROM 'c:\myfile.txt' WITH (FIELDTERMINATOR = ',')
> SELECT * FROM Tmp
> Later on you can convert VARCHAR to DATETIME datatype
> "Thiru.net" <thirudot...@.gmail.com> wrote in message
> news:1193915642.828573.240090@.q5g2000prf.googlegroups.com...
>
> > Hi,
> > I have problem in BCP utility while exporting data to sql server.
> > It works in my system and my friend's system , but it gives the
> > following when its run in production
> > server.
> > SQLState = 22007, NativeError = 0
> > Error = [Microsoft][SQL Native Client]Invalid date format
> > SQLState = 22007, NativeError = 0
> > Error = [Microsoft][SQL Native Client]Invalid date format
> > SQLState = 22007, NativeError = 0
> > Error = [Microsoft][SQL Native Client]Invalid date format
> > SQLState = 22007, NativeError = 0
> > Error = [Microsoft][SQL Native Client]Invalid date format
> > SQLState = 22007, NativeError = 0
> > Error = [Microsoft][SQL Native Client]Invalid date format
> > SQLState = 22007, NativeError = 0
> > Error = [Microsoft][SQL Native Client]Invalid date format
> > SQLState = 22007, NativeError = 0
> > Error = [Microsoft][SQL Native Client]Invalid date format
> > SQLState = 22007, NativeError = 0
> > Error = [Microsoft][SQL Native Client]Invalid date format
> > SQLState = 22007, NativeError = 0
> > Error = [Microsoft][SQL Native Client]Invalid date format
> > SQLState = 22007, NativeError = 0
> > Error = [Microsoft][SQL Native Client]Invalid date format
> > BCP copy in failed
> > there are about 365000 records in the data file...
> > the date values go like below;
> > 5/30/2007 9:27:35 AM
> > 5/30/2007 9:28:37 AM
> > 5/30/2007 5:28:16 PM
> > 5/30/2007 5:28:32 PM
> > 5/30/2007 5:28:16 PM
> > please help me for this problem...
> > thanks,
> > Thiru- Hide quoted text -
> - Show quoted text -
Hi,
Thanks for your reply, actually I am using bcp command-lind utility
here. I cant change the datatype in the production server..
Thanks,
Thiru

BCP invalid date

Hi,
I have problem in BCP utility while exporting data to sql server.
It works in my system and my friend's system , but it gives the
following when its run in production
server.
SQLState = 22007, NativeError = 0
Error = [Microsoft][SQL Native Client]Invalid date format
SQLState = 22007, NativeError = 0
Error = [Microsoft][SQL Native Client]Invalid date format
SQLState = 22007, NativeError = 0
Error = [Microsoft][SQL Native Client]Invalid date format
SQLState = 22007, NativeError = 0
Error = [Microsoft][SQL Native Client]Invalid date format
SQLState = 22007, NativeError = 0
Error = [Microsoft][SQL Native Client]Invalid date format
SQLState = 22007, NativeError = 0
Error = [Microsoft][SQL Native Client]Invalid date format
SQLState = 22007, NativeError = 0
Error = [Microsoft][SQL Native Client]Invalid date format
SQLState = 22007, NativeError = 0
Error = [Microsoft][SQL Native Client]Invalid date format
SQLState = 22007, NativeError = 0
Error = [Microsoft][SQL Native Client]Invalid date format
SQLState = 22007, NativeError = 0
Error = [Microsoft][SQL Native Client]Invalid date format
BCP copy in failed
there are about 365000 records in the data file...
the date values go like below;
5/30/2007 9:27:35 AM
5/30/2007 9:28:37 AM
5/30/2007 5:28:16 PM
5/30/2007 5:28:32 PM
5/30/2007 5:28:16 PM
please help me for this problem...
thanks,
ThiruThiru,
This could be because the regional settings of the server are different, or
your login's language setting on SQL Server is different. The problem is
that going into your server it is probably interpreting 5/30/2007 as: Day 5
of Month 30, which is invalid, of course.
If that is the problem, create a login on your SQL Server with a
default_language that uses the proper regional settings. For example:
Create Login AmericanImport WITH Password '####',
default_language='us_english'
Grant the AmericanImport login enough rights to bcp in the data to your
database, then run bcp using the AmericanImport login, which is using a
language setting that will properly interpret dates in this format.
RLF
"Thiru.net" <thirudotnet@.gmail.com> wrote in message
news:1193915612.728350.46490@.i13g2000prf.googlegroups.com...
> Hi,
> I have problem in BCP utility while exporting data to sql server.
> It works in my system and my friend's system , but it gives the
> following when its run in production
> server.
> SQLState = 22007, NativeError = 0
> Error = [Microsoft][SQL Native Client]Invalid date format
> SQLState = 22007, NativeError = 0
> Error = [Microsoft][SQL Native Client]Invalid date format
> SQLState = 22007, NativeError = 0
> Error = [Microsoft][SQL Native Client]Invalid date format
> SQLState = 22007, NativeError = 0
> Error = [Microsoft][SQL Native Client]Invalid date format
> SQLState = 22007, NativeError = 0
> Error = [Microsoft][SQL Native Client]Invalid date format
> SQLState = 22007, NativeError = 0
> Error = [Microsoft][SQL Native Client]Invalid date format
> SQLState = 22007, NativeError = 0
> Error = [Microsoft][SQL Native Client]Invalid date format
> SQLState = 22007, NativeError = 0
> Error = [Microsoft][SQL Native Client]Invalid date format
> SQLState = 22007, NativeError = 0
> Error = [Microsoft][SQL Native Client]Invalid date format
> SQLState = 22007, NativeError = 0
> Error = [Microsoft][SQL Native Client]Invalid date format
> BCP copy in failed
> there are about 365000 records in the data file...
> the date values go like below;
> 5/30/2007 9:27:35 AM
> 5/30/2007 9:28:37 AM
> 5/30/2007 5:28:16 PM
> 5/30/2007 5:28:32 PM
> 5/30/2007 5:28:16 PM
> please help me for this problem...
> thanks,
> Thiru
>

2012年3月8日星期四

bcp Execution

Hai..

I have two systems. SQL server 2000 is installed in one system (SERVER ) and the client tools are installed in a seperate system (Client)
My question is from which system should i have to execute the bcp command line utility, from the server or from the client. ?

Thanks in advance...

with regards
Sudari would have thought it would be best to run it on the server myself, but it really depends what you are trying to do.|||Hai..

thnks for your reply...

Actually i want to know whether it is possible to execute bcp from client or not and if yes then how.. ?

bcoz there is no argument in bcp to identify the server name..

thnks in advance

With regards
Sudar|||Did you try -s ?|||Thnks kaiowas it's working correctly.....

2012年3月6日星期二

bcp error, Syntax Error in '-C'

Hi
When running the following on a customer system Iget an error. However
when I run it on my system it works fine. Any help would be
appreciated.
bcp MYDATABASE..MYTABLE in TABLE.dat -c -C RAW >>result.txt -Usa -P
It gives the following error:
usage: bcp [[database_name.]owner.]table_name[:slice_number] {in |
out} datafile
[-m maxerrors] [-f formatfile] [-e errfile]
[-F firstrow] [-L lastrow] [-b batchsize]
[-n] [-c] [-t field_terminator] [-r row_terminator]
[-U username] [-P password] [-I interfaces_file] [-S server]
[-a display_charset] [-q datafile_charset] [-z language] [-v]
[-A packet size] [-J client character set]
[-T text or image size] [-E] [-g id_start_value] [-N] [-X]
[-M LabelName LabelValue] [-labeled]
[-K keytab_file] [-R remote_server_principal]
[-V [security_options]] [-Z security_mechanism] [-Q]
Syntax Error in '-C'.
Thanks
/PatrikHi,
What version of SQL Server/client is using from clients place. "-C"
parameter is not available in
versions before SQL 7.
Based on the error log I feel that the customer place they are using SQL
6.5. Please verify that.
--
Thanks
Hari
MCDBA
"Patrik Johansson" <patrikmjohansson@.yahoo.se> wrote in message
news:8d5c526d.0406240242.7aff6ec3@.posting.google.com...
> Hi
> When running the following on a customer system Iget an error. However
> when I run it on my system it works fine. Any help would be
> appreciated.
> bcp MYDATABASE..MYTABLE in TABLE.dat -c -C RAW >>result.txt -Usa -P
> It gives the following error:
> usage: bcp [[database_name.]owner.]table_name[:slice_number] {in |
> out} datafile
> [-m maxerrors] [-f formatfile] [-e errfile]
> [-F firstrow] [-L lastrow] [-b batchsize]
> [-n] [-c] [-t field_terminator] [-r row_terminator]
> [-U username] [-P password] [-I interfaces_file] [-S server]
> [-a display_charset] [-q datafile_charset] [-z language] [-v]
> [-A packet size] [-J client character set]
> [-T text or image size] [-E] [-g id_start_value] [-N] [-X]
> [-M LabelName LabelValue] [-labeled]
> [-K keytab_file] [-R remote_server_principal]
> [-V [security_options]] [-Z security_mechanism] [-Q]
> Syntax Error in '-C'.
>
> Thanks
> /Patrik|||Hi
I can not re-create this error! Posting the version of SQL Server you are
using may help as I don't recognise some of the options that are given
and -C is not one of them!!
I would also move the output redirection to the end of the line.
John
"Patrik Johansson" <patrikmjohansson@.yahoo.se> wrote in message
news:8d5c526d.0406240242.7aff6ec3@.posting.google.com...
> Hi
> When running the following on a customer system Iget an error. However
> when I run it on my system it works fine. Any help would be
> appreciated.
> bcp MYDATABASE..MYTABLE in TABLE.dat -c -C RAW >>result.txt -Usa -P
> It gives the following error:
> usage: bcp [[database_name.]owner.]table_name[:slice_number] {in |
> out} datafile
> [-m maxerrors] [-f formatfile] [-e errfile]
> [-F firstrow] [-L lastrow] [-b batchsize]
> [-n] [-c] [-t field_terminator] [-r row_terminator]
> [-U username] [-P password] [-I interfaces_file] [-S server]
> [-a display_charset] [-q datafile_charset] [-z language] [-v]
> [-A packet size] [-J client character set]
> [-T text or image size] [-E] [-g id_start_value] [-N] [-X]
> [-M LabelName LabelValue] [-labeled]
> [-K keytab_file] [-R remote_server_principal]
> [-V [security_options]] [-Z security_mechanism] [-Q]
> Syntax Error in '-C'.
>
> Thanks
> /Patrik|||Hi again and thanks for the replies.
The customer claims to have SQL Server 2000 with SP3. However I'm
thinking that they may have an old/other bcp installed which doesn't
recognize the -C option
(as we can see in the error msg, their bcp doesn't seem to support the
-C).
/Patrik
"John Bell" <jbellnewsposts@.hotmail.com> wrote in message news:<O57OAvdWEHA.1164@.tk2msftngp13.phx.gbl>...
> Hi
> I can not re-create this error! Posting the version of SQL Server you are
> using may help as I don't recognise some of the options that are given
> and -C is not one of them!!
> I would also move the output redirection to the end of the line.
> John
>
> "Patrik Johansson" <patrikmjohansson@.yahoo.se> wrote in message
> news:8d5c526d.0406240242.7aff6ec3@.posting.google.com...
> > Hi
> > When running the following on a customer system Iget an error. However
> > when I run it on my system it works fine. Any help would be
> > appreciated.
> >
> > bcp MYDATABASE..MYTABLE in TABLE.dat -c -C RAW >>result.txt -Usa -P
> >
> > It gives the following error:
> >
> > usage: bcp [[database_name.]owner.]table_name[:slice_number] {in |
> > out} datafile
> > [-m maxerrors] [-f formatfile] [-e errfile]
> > [-F firstrow] [-L lastrow] [-b batchsize]
> > [-n] [-c] [-t field_terminator] [-r row_terminator]
> > [-U username] [-P password] [-I interfaces_file] [-S server]
> > [-a display_charset] [-q datafile_charset] [-z language] [-v]
> > [-A packet size] [-J client character set]
> > [-T text or image size] [-E] [-g id_start_value] [-N] [-X]
> > [-M LabelName LabelValue] [-labeled]
> > [-K keytab_file] [-R remote_server_principal]
> > [-V [security_options]] [-Z security_mechanism] [-Q]
> > Syntax Error in '-C'.
> >
> >
> > Thanks
> > /Patrik|||Hi
-C would be used for backward compatibility, therefore there should not be
any need to use it!!
You may try the command
where bcp.exe
And then check size/date/file versions
John
"Patrik Johansson" <patrikmjohansson@.yahoo.se> wrote in message
news:8d5c526d.0406280400.79dffaad@.posting.google.com...
> Hi again and thanks for the replies.
> The customer claims to have SQL Server 2000 with SP3. However I'm
> thinking that they may have an old/other bcp installed which doesn't
> recognize the -C option
> (as we can see in the error msg, their bcp doesn't seem to support the
> -C).
> /Patrik
> "John Bell" <jbellnewsposts@.hotmail.com> wrote in message
news:<O57OAvdWEHA.1164@.tk2msftngp13.phx.gbl>...
> > Hi
> >
> > I can not re-create this error! Posting the version of SQL Server you
are
> > using may help as I don't recognise some of the options that are given
> > and -C is not one of them!!
> >
> > I would also move the output redirection to the end of the line.
> >
> > John
> >
> >
> > "Patrik Johansson" <patrikmjohansson@.yahoo.se> wrote in message
> > news:8d5c526d.0406240242.7aff6ec3@.posting.google.com...
> > > Hi
> > > When running the following on a customer system Iget an error. However
> > > when I run it on my system it works fine. Any help would be
> > > appreciated.
> > >
> > > bcp MYDATABASE..MYTABLE in TABLE.dat -c -C RAW >>result.txt -Usa -P
> > >
> > > It gives the following error:
> > >
> > > usage: bcp [[database_name.]owner.]table_name[:slice_number] {in |
> > > out} datafile
> > > [-m maxerrors] [-f formatfile] [-e errfile]
> > > [-F firstrow] [-L lastrow] [-b batchsize]
> > > [-n] [-c] [-t field_terminator] [-r row_terminator]
> > > [-U username] [-P password] [-I interfaces_file] [-S server]
> > > [-a display_charset] [-q datafile_charset] [-z language] [-v]
> > > [-A packet size] [-J client character set]
> > > [-T text or image size] [-E] [-g id_start_value] [-N] [-X]
> > > [-M LabelName LabelValue] [-labeled]
> > > [-K keytab_file] [-R remote_server_principal]
> > > [-V [security_options]] [-Z security_mechanism] [-Q]
> > > Syntax Error in '-C'.
> > >
> > >
> > > Thanks
> > > /Patrik

bcp error, Syntax Error in '-C'

Hi
When running the following on a customer system Iget an error. However
when I run it on my system it works fine. Any help would be
appreciated.
bcp MYDATABASE..MYTABLE in TABLE.dat -c -C RAW >>result.txt -Usa -P
It gives the following error:
usage: bcp [[database_name.]owner.]table_name[:slice_number] {in |
out} datafile
[-m maxerrors] [-f formatfile] [-e errfile]
[-F firstrow] [-L lastrow] [-b batchsize]
[-n] [-c] [-t field_terminator] [-r row_terminator]
[-U username] [-P password] [-I interfaces_file] [-S server]
[-a display_charset] [-q datafile_charset] [-z language] [-v]
[-A packet size] [-J client character set]
[-T text or image size] [-E] [-g id_start_value] [-N] [-X]
[-M LabelName LabelValue] [-labeled]
[-K keytab_file] [-R remote_server_principal]
[-V [security_options]] [-Z security_mechanism] [-Q]
Syntax Error in '-C'.
Thanks
/Patrik
Hi,
What version of SQL Server/client is using from clients place. "-C"
parameter is not available in
versions before SQL 7.
Based on the error log I feel that the customer place they are using SQL
6.5. Please verify that.
Thanks
Hari
MCDBA
"Patrik Johansson" <patrikmjohansson@.yahoo.se> wrote in message
news:8d5c526d.0406240242.7aff6ec3@.posting.google.c om...
> Hi
> When running the following on a customer system Iget an error. However
> when I run it on my system it works fine. Any help would be
> appreciated.
> bcp MYDATABASE..MYTABLE in TABLE.dat -c -C RAW >>result.txt -Usa -P
> It gives the following error:
> usage: bcp [[database_name.]owner.]table_name[:slice_number] {in |
> out} datafile
> [-m maxerrors] [-f formatfile] [-e errfile]
> [-F firstrow] [-L lastrow] [-b batchsize]
> [-n] [-c] [-t field_terminator] [-r row_terminator]
> [-U username] [-P password] [-I interfaces_file] [-S server]
> [-a display_charset] [-q datafile_charset] [-z language] [-v]
> [-A packet size] [-J client character set]
> [-T text or image size] [-E] [-g id_start_value] [-N] [-X]
> [-M LabelName LabelValue] [-labeled]
> [-K keytab_file] [-R remote_server_principal]
> [-V [security_options]] [-Z security_mechanism] [-Q]
> Syntax Error in '-C'.
>
> Thanks
> /Patrik
|||Hi
I can not re-create this error! Posting the version of SQL Server you are
using may help as I don't recognise some of the options that are given
and -C is not one of them!!
I would also move the output redirection to the end of the line.
John
"Patrik Johansson" <patrikmjohansson@.yahoo.se> wrote in message
news:8d5c526d.0406240242.7aff6ec3@.posting.google.c om...
> Hi
> When running the following on a customer system Iget an error. However
> when I run it on my system it works fine. Any help would be
> appreciated.
> bcp MYDATABASE..MYTABLE in TABLE.dat -c -C RAW >>result.txt -Usa -P
> It gives the following error:
> usage: bcp [[database_name.]owner.]table_name[:slice_number] {in |
> out} datafile
> [-m maxerrors] [-f formatfile] [-e errfile]
> [-F firstrow] [-L lastrow] [-b batchsize]
> [-n] [-c] [-t field_terminator] [-r row_terminator]
> [-U username] [-P password] [-I interfaces_file] [-S server]
> [-a display_charset] [-q datafile_charset] [-z language] [-v]
> [-A packet size] [-J client character set]
> [-T text or image size] [-E] [-g id_start_value] [-N] [-X]
> [-M LabelName LabelValue] [-labeled]
> [-K keytab_file] [-R remote_server_principal]
> [-V [security_options]] [-Z security_mechanism] [-Q]
> Syntax Error in '-C'.
>
> Thanks
> /Patrik
|||Hi again and thanks for the replies.
The customer claims to have SQL Server 2000 with SP3. However I'm
thinking that they may have an old/other bcp installed which doesn't
recognize the -C option
(as we can see in the error msg, their bcp doesn't seem to support the
-C).
/Patrik
"John Bell" <jbellnewsposts@.hotmail.com> wrote in message news:<O57OAvdWEHA.1164@.tk2msftngp13.phx.gbl>...[vbcol=seagreen]
> Hi
> I can not re-create this error! Posting the version of SQL Server you are
> using may help as I don't recognise some of the options that are given
> and -C is not one of them!!
> I would also move the output redirection to the end of the line.
> John
>
> "Patrik Johansson" <patrikmjohansson@.yahoo.se> wrote in message
> news:8d5c526d.0406240242.7aff6ec3@.posting.google.c om...
|||Hi
-C would be used for backward compatibility, therefore there should not be
any need to use it!!
You may try the command
where bcp.exe
And then check size/date/file versions
John
"Patrik Johansson" <patrikmjohansson@.yahoo.se> wrote in message
news:8d5c526d.0406280400.79dffaad@.posting.google.c om...
> Hi again and thanks for the replies.
> The customer claims to have SQL Server 2000 with SP3. However I'm
> thinking that they may have an old/other bcp installed which doesn't
> recognize the -C option
> (as we can see in the error msg, their bcp doesn't seem to support the
> -C).
> /Patrik
> "John Bell" <jbellnewsposts@.hotmail.com> wrote in message
news:<O57OAvdWEHA.1164@.tk2msftngp13.phx.gbl>...[vbcol=seagreen]
are[vbcol=seagreen]
|||Hi
-C would be used for backward compatibility, therefore there should not be
any need to use it!!
You may try the command
where bcp.exe
And then check size/date/file versions
John
"Patrik Johansson" <patrikmjohansson@.yahoo.se> wrote in message
news:8d5c526d.0406280400.79dffaad@.posting.google.c om...
> Hi again and thanks for the replies.
> The customer claims to have SQL Server 2000 with SP3. However I'm
> thinking that they may have an old/other bcp installed which doesn't
> recognize the -C option
> (as we can see in the error msg, their bcp doesn't seem to support the
> -C).
> /Patrik
> "John Bell" <jbellnewsposts@.hotmail.com> wrote in message
news:<O57OAvdWEHA.1164@.tk2msftngp13.phx.gbl>...[vbcol=seagreen]
are[vbcol=seagreen]

bcp error, Syntax Error in '-C'

Hi
When running the following on a customer system Iget an error. However
when I run it on my system it works fine. Any help would be
appreciated.
bcp MYDATABASE..MYTABLE in TABLE.dat -c -C RAW >>result.txt -Usa -P
It gives the following error:
usage: bcp [[database_name.]owner.]table_name[:slice_number] 
23;in |
out} datafile
[-m maxerrors] [-f formatfile] [-e errfile]
[-F firstrow] [-L lastrow] [-b batchsize]
[-n] [-c] [-t field_terminator] [-r row_terminator]
[-U username] [-P password] [-I interfaces_file] [-S server]
[-a display_charset] [-q datafile_charset] [-z language] [-v
]
[-A packet size] [-J client character set]
[-T text or image size] [-E] [-g id_start_value] [-N] [-
X]
[-M LabelName LabelValue] [-labeled]
[-K keytab_file] [-R remote_server_principal]
[-V [security_options]] [-Z security_mechanism] [-Q]
Syntax Error in '-C'.
Thanks
/PatrikHi,
What version of SQL Server/client is using from clients place. "-C"
parameter is not available in
versions before SQL 7.
Based on the error log I feel that the customer place they are using SQL
6.5. Please verify that.
Thanks
Hari
MCDBA
"Patrik Johansson" <patrikmjohansson@.yahoo.se> wrote in message
news:8d5c526d.0406240242.7aff6ec3@.posting.google.com...
> Hi
> When running the following on a customer system Iget an error. However
> when I run it on my system it works fine. Any help would be
> appreciated.
> bcp MYDATABASE..MYTABLE in TABLE.dat -c -C RAW >>result.txt -Usa -P
> It gives the following error:
> usage: bcp [[database_name.]owner.]table_name[:slice_number] &
#123;in |
> out} datafile
> [-m maxerrors] [-f formatfile] [-e errfile]
> [-F firstrow] [-L lastrow] [-b batchsize]
> [-n] [-c] [-t field_terminator] [-r row_terminator]
> [-U username] [-P password] [-I interfaces_file] [-S serve
r]
> [-a display_charset] [-q datafile_charset] [-z language] [
-v]
> [-A packet size] [-J client character set]
> [-T text or image size] [-E] [-g id_start_value] [-N] [
;-X]
> [-M LabelName LabelValue] [-labeled]
> [-K keytab_file] [-R remote_server_principal]
> [-V [security_options]] [-Z security_mechanism] [-Q]
> Syntax Error in '-C'.
>
> Thanks
> /Patrik|||Hi
I can not re-create this error! Posting the version of SQL Server you are
using may help as I don't recognise some of the options that are given
and -C is not one of them!!
I would also move the output redirection to the end of the line.
John
"Patrik Johansson" <patrikmjohansson@.yahoo.se> wrote in message
news:8d5c526d.0406240242.7aff6ec3@.posting.google.com...
> Hi
> When running the following on a customer system Iget an error. However
> when I run it on my system it works fine. Any help would be
> appreciated.
> bcp MYDATABASE..MYTABLE in TABLE.dat -c -C RAW >>result.txt -Usa -P
> It gives the following error:
> usage: bcp [[database_name.]owner.]table_name[:slice_number] &
#123;in |
> out} datafile
> [-m maxerrors] [-f formatfile] [-e errfile]
> [-F firstrow] [-L lastrow] [-b batchsize]
> [-n] [-c] [-t field_terminator] [-r row_terminator]
> [-U username] [-P password] [-I interfaces_file] [-S serve
r]
> [-a display_charset] [-q datafile_charset] [-z language] [
-v]
> [-A packet size] [-J client character set]
> [-T text or image size] [-E] [-g id_start_value] [-N] [
;-X]
> [-M LabelName LabelValue] [-labeled]
> [-K keytab_file] [-R remote_server_principal]
> [-V [security_options]] [-Z security_mechanism] [-Q]
> Syntax Error in '-C'.
>
> Thanks
> /Patrik|||Hi again and thanks for the replies.
The customer claims to have SQL Server 2000 with SP3. However I'm
thinking that they may have an old/other bcp installed which doesn't
recognize the -C option
(as we can see in the error msg, their bcp doesn't seem to support the
-C).
/Patrik
"John Bell" <jbellnewsposts@.hotmail.com> wrote in message news:<O57OAvdWEHA.1164@.tk2msftngp1
3.phx.gbl>...[vbcol=seagreen]
> Hi
> I can not re-create this error! Posting the version of SQL Server you are
> using may help as I don't recognise some of the options that are given
> and -C is not one of them!!
> I would also move the output redirection to the end of the line.
> John
>
> "Patrik Johansson" <patrikmjohansson@.yahoo.se> wrote in message
> news:8d5c526d.0406240242.7aff6ec3@.posting.google.com...|||Hi
-C would be used for backward compatibility, therefore there should not be
any need to use it!!
You may try the command
where bcp.exe
And then check size/date/file versions
John
"Patrik Johansson" <patrikmjohansson@.yahoo.se> wrote in message
news:8d5c526d.0406280400.79dffaad@.posting.google.com...
> Hi again and thanks for the replies.
> The customer claims to have SQL Server 2000 with SP3. However I'm
> thinking that they may have an old/other bcp installed which doesn't
> recognize the -C option
> (as we can see in the error msg, their bcp doesn't seem to support the
> -C).
> /Patrik
> "John Bell" <jbellnewsposts@.hotmail.com> wrote in message
news:<O57OAvdWEHA.1164@.tk2msftngp13.phx.gbl>...[vbcol=seagreen]
are[vbcol=seagreen]|||The command you are running is not the SQL Server bcp.exe, but the Sybase bc
p.exe. To fix the problem, specify the full path to the SQL Server version.
If you are using xp_cmdshell you may have to put the bcp command into a .B
AT file.
Hope this helps,
Bill
P.S. Check out http://www.sqleditor.com for a great SQL Server explorer.

2012年2月25日星期六

bcp connection problems

Well this one is puzzling me, and there is probably a very simple answer to this but coming from a linux/MySQL background to a windows/MSSQL system I can't figure it out.

Anyways I run bcp with my queryout string which is

bcp "SELECT * FROM edrdata.dbo.tblcomments WHERE siteid=-1" queryout "C:\DKD\" -c -U <username> -P <password> -S WELLDAQ\DBINFO

but I get an ODBC connection error, see below :

SQLState = 08001, NativeError = 17
Error = [Microsoft][ODBC SQL Server Driver][Shared Memory] SQL Server does not exist or access denied.
SQLState = 01000, NativeError = 2
Warning = [Microsoft][ODBC SQL Server Driver][Shared memory]ConnectionOpen (Connect()).

oh and SQL Server Service Manager shows the Server as WELLDAQ\DBINFO and it is running and I can connect to it through other means such as my visual basic applications I'm coding and through Visual Studio 2005 (remotely) so why can't bcp connect to it?

pls check your your surface area configuration if

1. the server is running in mixed mode

2. the server is configured to accept both local and remote connection

|||

Make sure there are no spaces between the -U and the username. Same for -P and -S

Also, specify a filename as well as the directory path and put the -S parameter before the -U and -P

Hope this helps.

BCP connection problem

Hi,
I am trying to use BCP for bulk importing data into the SQL-server. I
created a system DSN that works fine with MS-Query, but bcp keeps returning
an error:
SQLState = 08001, NativeError = 17
Error = [Microsoft][ODBC SQL Server Driver][DBNETLIB]SQL Server does not
exist or access denied.
SQLState = 01000, NativeError = 53
Warning = [Microsoft][ODBC SQL Server Driver][DBNETLIB]ConnectionOpen
(Connect()).
Can anybody tell me what's wrong here (or offer an alternative for bulk
importing data)?
thanks in advance, Hans
Hans,
What is the full command that you are using to bcp in your data? There
may be a problem with the bcp syntax that you are using and not with the
DSN.
Thanks,
JD
"Hans" <Hans@.discussions.microsoft.com> wrote in message
news:B0315ACB-43DF-4663-B9C1-9460BA7208DE@.microsoft.com...
> Hi,
> I am trying to use BCP for bulk importing data into the SQL-server. I
> created a system DSN that works fine with MS-Query, but bcp keeps
returning
> an error:
> SQLState = 08001, NativeError = 17
> Error = [Microsoft][ODBC SQL Server Driver][DBNETLIB]SQL Server does not
> exist or access denied.
> SQLState = 01000, NativeError = 53
> Warning = [Microsoft][ODBC SQL Server Driver][DBNETLIB]ConnectionOpen
> (Connect()).
> Can anybody tell me what's wrong here (or offer an alternative for bulk
> importing data)?
> thanks in advance, Hans

2012年2月13日星期一

Batch file call to SQL Agent to make Bakcup

Hello.
I've a Backup system that copies my files and I want to copy also my
SQL Server DDBB. I intend to execute the batch file before de File
Backup starts to call de SQL Agent so it makes those Backups and then
copy them to the Backup folder so the Backup system copies everything.
The problem is that I don't know if it is possible to call to the SQL
Agent through a Batch file to make these Backups. If so, how could I
do it?
Thank you.
One suggestion ... instead of having the batch file calling the SQL Agent,
you can use the OSQL utility (it is a command line utility for SQL). You can
backup the database using OSQL.
Thank you
Lucas
"Gurk" <gurkgamer@.gmail.com> wrote in message
news:1181666228.803256.267530@.d30g2000prg.googlegr oups.com...
> Hello.
> I've a Backup system that copies my files and I want to copy also my
> SQL Server DDBB. I intend to execute the batch file before de File
> Backup starts to call de SQL Agent so it makes those Backups and then
> copy them to the Backup folder so the Backup system copies everything.
> The problem is that I don't know if it is possible to call to the SQL
> Agent through a Batch file to make these Backups. If so, how could I
> do it?
> Thank you.
>
|||If the backup script is in a job, you can execute that job
through OSQL, SQLCMD, etc by executing sp_start_job. You can
find more information on sp_start_job in books online
-Sue
On Tue, 12 Jun 2007 09:37:08 -0700, Gurk
<gurkgamer@.gmail.com> wrote:

>Hello.
>I've a Backup system that copies my files and I want to copy also my
>SQL Server DDBB. I intend to execute the batch file before de File
>Backup starts to call de SQL Agent so it makes those Backups and then
>copy them to the Backup folder so the Backup system copies everything.
>The problem is that I don't know if it is possible to call to the SQL
>Agent through a Batch file to make these Backups. If so, how could I
>do it?
>Thank you.

Batch file call to SQL Agent to make Bakcup

Hello.
I've a Backup system that copies my files and I want to copy also my
SQL Server DDBB. I intend to execute the batch file before de File
Backup starts to call de SQL Agent so it makes those Backups and then
copy them to the Backup folder so the Backup system copies everything.
The problem is that I don't know if it is possible to call to the SQL
Agent through a Batch file to make these Backups. If so, how could I
do it?
Thank you.One suggestion ... instead of having the batch file calling the SQL Agent,
you can use the OSQL utility (it is a command line utility for SQL). You can
backup the database using OSQL.
Thank you
Lucas
"Gurk" <gurkgamer@.gmail.com> wrote in message
news:1181666228.803256.267530@.d30g2000prg.googlegroups.com...
> Hello.
> I've a Backup system that copies my files and I want to copy also my
> SQL Server DDBB. I intend to execute the batch file before de File
> Backup starts to call de SQL Agent so it makes those Backups and then
> copy them to the Backup folder so the Backup system copies everything.
> The problem is that I don't know if it is possible to call to the SQL
> Agent through a Batch file to make these Backups. If so, how could I
> do it?
> Thank you.
>|||If the backup script is in a job, you can execute that job
through OSQL, SQLCMD, etc by executing sp_start_job. You can
find more information on sp_start_job in books online
-Sue
On Tue, 12 Jun 2007 09:37:08 -0700, Gurk
<gurkgamer@.gmail.com> wrote:
>Hello.
>I've a Backup system that copies my files and I want to copy also my
>SQL Server DDBB. I intend to execute the batch file before de File
>Backup starts to call de SQL Agent so it makes those Backups and then
>copy them to the Backup folder so the Backup system copies everything.
>The problem is that I don't know if it is possible to call to the SQL
>Agent through a Batch file to make these Backups. If so, how could I
>do it?
>Thank you.

Batch file call to SQL Agent to make Bakcup

Hello.
I've a Backup system that copies my files and I want to copy also my
SQL Server DDBB. I intend to execute the batch file before de File
Backup starts to call de SQL Agent so it makes those Backups and then
copy them to the Backup folder so the Backup system copies everything.
The problem is that I don't know if it is possible to call to the SQL
Agent through a Batch file to make these Backups. If so, how could I
do it?
Thank you.One suggestion ... instead of having the batch file calling the SQL Agent,
you can use the OSQL utility (it is a command line utility for SQL). You can
backup the database using OSQL.
Thank you
Lucas
"Gurk" <gurkgamer@.gmail.com> wrote in message
news:1181666228.803256.267530@.d30g2000prg.googlegroups.com...
> Hello.
> I've a Backup system that copies my files and I want to copy also my
> SQL Server DDBB. I intend to execute the batch file before de File
> Backup starts to call de SQL Agent so it makes those Backups and then
> copy them to the Backup folder so the Backup system copies everything.
> The problem is that I don't know if it is possible to call to the SQL
> Agent through a Batch file to make these Backups. If so, how could I
> do it?
> Thank you.
>|||If the backup script is in a job, you can execute that job
through OSQL, SQLCMD, etc by executing sp_start_job. You can
find more information on sp_start_job in books online
-Sue
On Tue, 12 Jun 2007 09:37:08 -0700, Gurk
<gurkgamer@.gmail.com> wrote:

>Hello.
>I've a Backup system that copies my files and I want to copy also my
>SQL Server DDBB. I intend to execute the batch file before de File
>Backup starts to call de SQL Agent so it makes those Backups and then
>copy them to the Backup folder so the Backup system copies everything.
>The problem is that I don't know if it is possible to call to the SQL
>Agent through a Batch file to make these Backups. If so, how could I
>do it?
>Thank you.