2012年3月25日星期日
BCP table export and Shared Locks
We use BCP commands like this:
BCP ACC.Dbo.[TableName] out CSV\ TableName.csv /c /k /t "|" /r
"\n" -Sservername -Uname -Ppass
to extract data from SQL Server into CSV files.
I want BCP don't put any lock, including shared lock, on table records. How
can I supply locking hint (NOLOCK) along with the table name?
We try not to use the actual query and just put the table name on the
command line.
Thank you,
AlanTry append -hnolock to the command.
Lucas
"Maxwell2006" wrote:
> Hi,
>
> We use BCP commands like this:
>
> BCP ACC.Dbo.[TableName] out CSV\ TableName.csv /c /k /t "|" /r
> "\n" -Sservername -Uname -Ppass
>
> to extract data from SQL Server into CSV files.
>
> I want BCP don't put any lock, including shared lock, on table records. How
> can I supply locking hint (NOLOCK) along with the table name?
>
> We try not to use the actual query and just put the table name on the
> command line.
>
> Thank you,
> Alan
>
>
>|||Hi Max,
Thank you for posting.
As for the SQL server bcp utility, currently there is only a "TABLOCK" hint
option whch can help switch the lock (when performing bulk
importing/exporting) between row level lock and table level lock.
Therefore, if we need to completely disable any lock when performing the
bulk exporting, we still have to use explicit T-SQL script to do it.
#bcp Utility
http://msdn2.microsoft.com/en-us/library/ms162802.aspx
BTW, if you do not want to pass the T-SQL directly in command prompt, do
you think it possible that we use a batch/script file to programmatically
load such T-SQL script and launch the bcp utility command?
Anyway, please feel free to let me know if you have any other consideration.
Regards,
Steven Cheng
Microsoft MSDN Online Support Lead
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)|||Thank you Steven.
I changed our export scripts to use the query "select * from tableName
(NOLOCK)".
Max
"Steven Cheng[MSFT]" <stcheng@.online.microsoft.com> wrote in message
news:t8tbYX3jGHA.4528@.TK2MSFTNGXA01.phx.gbl...
> Hi Max,
> Thank you for posting.
> As for the SQL server bcp utility, currently there is only a "TABLOCK"
> hint
> option whch can help switch the lock (when performing bulk
> importing/exporting) between row level lock and table level lock.
> Therefore, if we need to completely disable any lock when performing the
> bulk exporting, we still have to use explicit T-SQL script to do it.
> #bcp Utility
> http://msdn2.microsoft.com/en-us/library/ms162802.aspx
> BTW, if you do not want to pass the T-SQL directly in command prompt, do
> you think it possible that we use a batch/script file to programmatically
> load such T-SQL script and launch the bcp utility command?
> Anyway, please feel free to let me know if you have any other
> consideration.
> Regards,
> Steven Cheng
> Microsoft MSDN Online Support Lead
>
> ==================================================> When responding to posts, please "Reply to Group" via your newsreader so
> that others may learn and benefit from your issue.
> ==================================================>
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
>
> Get Secure! www.microsoft.com/security
> (This posting is provided "AS IS", with no warranties, and confers no
> rights.)
>|||Thanks for your followup Max,
Glad that you've got a solution to work on it. If there is anything else we
can help, please feel free to post here.
Regards,
Steven Cheng
Microsoft MSDN Online Support Lead
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
bcp syntax
bcp [cms user messaging archive].dbo.archivepurge out D:\SQLData\TEST\
archive.bcp -n -eD:\SQLData\TEST\error.txt
I get the following message:
Copy direction must be either 'in', 'out' or 'format'.
usage: bcp {dbtable | query} {in | out | queryout | format} datafile
[-m maxerrors] [-f formatfile] [-e errfile]
[-F firstrow] [-L lastrow] [-b batchsize]
[-n native type] [-c character type] [-w wide character
type]
[-N keep non-text native] [-6 6x file format] [-q quoted
identifier]
[-C code page specifier] [-t field terminator] [-r row terminator]
[-i inputfile] [-o outfile] [-a packetsize]
[-S server name] [-U username] [-P password]
[-T trusted connection] [-v version] [-R regional enable]
[-k keep null values] [-E keep identity values]
[-h "load hints"]
Please help.
Message posted via http://www.sqlmonster.com
Bcp uses parsename() to parse for object name. It seems to have problem
parsing back bracket.
Do this instead.
bcp "cms user messaging archive"."dbo"."archivepurge" out
"D:\SQLData\TEST\archive.bcp" -n -e"D:\SQLData\TEST\error.txt" -q
-oj
"Robert Richards via SQLMonster.com" <forum@.SQLMonster.com> wrote in message
news:e4ec7d6406fa4ad9955a3a244ea8b1f7@.SQLMonster.c om...
> When I run the following from the command line (referencing SQL 2K):
> bcp [cms user messaging archive].dbo.archivepurge out D:\SQLData\TEST\
> archive.bcp -n -eD:\SQLData\TEST\error.txt
> I get the following message:
> Copy direction must be either 'in', 'out' or 'format'.
> usage: bcp {dbtable | query} {in | out | queryout | format} datafile
> [-m maxerrors] [-f formatfile] [-e errfile]
> [-F firstrow] [-L lastrow] [-b batchsize]
> [-n native type] [-c character type] [-w wide character
> type]
> [-N keep non-text native] [-6 6x file format] [-q quoted
> identifier]
> [-C code page specifier] [-t field terminator] [-r row terminator]
> [-i inputfile] [-o outfile] [-a packetsize]
> [-S server name] [-U username] [-P password]
> [-T trusted connection] [-v version] [-R regional enable]
> [-k keep null values] [-E keep identity values]
> [-h "load hints"]
> Please help.
> --
> Message posted via http://www.sqlmonster.com
2012年3月22日星期四
bcp syntax
bcp [cms user messaging archive].dbo.archivepurge out D:\SQLData\TEST\
archive.bcp -n -eD:\SQLData\TEST\error.txt
I get the following message:
Copy direction must be either 'in', 'out' or 'format'.
usage: bcp {dbtable | query} {in | out | queryout | format} datafile
[-m maxerrors] [-f formatfile] [-e errfile]
[-F firstrow] [-L lastrow] [-b batchsize]
[-n native type] [-c character type] [-w wide character
type]
[-N keep non-text native] [-6 6x file format] [-q quoted
identifier]
[-C code page specifier] [-t field terminator] [-r row terminator]
[-i inputfile] [-o outfile] [-a packetsize]
[-S server name] [-U username] [-P password]
[-T trusted connection] [-v version] [-R regional enable]
[-k keep null values] [-E keep identity values]
[-h "load hints"]
Please help.
--
Message posted via http://www.sqlmonster.comBcp uses parsename() to parse for object name. It seems to have problem
parsing back bracket.
Do this instead.
bcp "cms user messaging archive"."dbo"."archivepurge" out
"D:\SQLData\TEST\archive.bcp" -n -e"D:\SQLData\TEST\error.txt" -q
--
-oj
"Robert Richards via SQLMonster.com" <forum@.SQLMonster.com> wrote in message
news:e4ec7d6406fa4ad9955a3a244ea8b1f7@.SQLMonster.com...
> When I run the following from the command line (referencing SQL 2K):
> bcp [cms user messaging archive].dbo.archivepurge out D:\SQLData\TEST\
> archive.bcp -n -eD:\SQLData\TEST\error.txt
> I get the following message:
> Copy direction must be either 'in', 'out' or 'format'.
> usage: bcp {dbtable | query} {in | out | queryout | format} datafile
> [-m maxerrors] [-f formatfile] [-e errfile]
> [-F firstrow] [-L lastrow] [-b batchsize]
> [-n native type] [-c character type] [-w wide character
> type]
> [-N keep non-text native] [-6 6x file format] [-q quoted
> identifier]
> [-C code page specifier] [-t field terminator] [-r row terminator]
> [-i inputfile] [-o outfile] [-a packetsize]
> [-S server name] [-U username] [-P password]
> [-T trusted connection] [-v version] [-R regional enable]
> [-k keep null values] [-E keep identity values]
> [-h "load hints"]
> Please help.
> --
> Message posted via http://www.sqlmonster.com
bcp syntax
bcp [cms user messaging archive].dbo.archivepurge out D:\SQLData\TEST\
archive.bcp -n -eD:\SQLData\TEST\error.txt
I get the following message:
Copy direction must be either 'in', 'out' or 'format'.
usage: bcp {dbtable | query} {in | out | queryout | format} datafi
le
[-m maxerrors] [-f formatfile] [-e errfile]
[-F firstrow] [-L lastrow] [-b batchsize]
[-n native type] [-c character type] [-w wide charact
er
type]
[-N keep non-text native] [-6 6x file format] [-q quoted
identifier]
[-C code page specifier] [-t field terminator] [-r row terminat
or]
[-i inputfile] [-o outfile] [-a packetsize]
[-S server name] [-U username] [-P password]
[-T trusted connection] [-v version] [-R regional ena
ble]
[-k keep null values] [-E keep identity values]
[-h "load hints"]
Please help.
Message posted via http://www.droptable.comBcp uses parsename() to parse for object name. It seems to have problem
parsing back bracket.
Do this instead.
bcp "cms user messaging archive"."dbo"."archivepurge" out
"D:\SQLData\TEST\archive.bcp" -n -e"D:\SQLData\TEST\error.txt" -q
-oj
"Robert Richards via droptable.com" <forum@.droptable.com> wrote in message
news:e4ec7d6406fa4ad9955a3a244ea8b1f7@.SQ
droptable.com...
> When I run the following from the command line (referencing SQL 2K):
> bcp [cms user messaging archive].dbo.archivepurge out D:\SQLData\TEST\
> archive.bcp -n -eD:\SQLData\TEST\error.txt
> I get the following message:
> Copy direction must be either 'in', 'out' or 'format'.
> usage: bcp {dbtable | query} {in | out | queryout | format} data
file
> [-m maxerrors] [-f formatfile] [-e errfile]
> [-F firstrow] [-L lastrow] [-b batchsize]
> [-n native type] [-c character type] [-w wide chara
cter
> type]
> [-N keep non-text native] [-6 6x file format] [-q quoted
> identifier]
> [-C code page specifier] [-t field terminator] [-r row termin
ator]
> [-i inputfile] [-o outfile] [-a packetsize
]
> [-S server name] [-U username] [-P password]
> [-T trusted connection] [-v version] [-R regional e
nable]
> [-k keep null values] [-E keep identity values]
> [-h "load hints"]
> Please help.
> --
> Message posted via http://www.droptable.comsql
BCP SQL Server 6.5
i tried using the BCP
bcp iac.dbo.sf_profil out c:\test.bcp /c /Slocal /Usa /Pabc123
bcp iac.dbo.sf_profil out c:\test.bcp /c /Svots138svr09 /Usa /Pabc123
bcp iac.dbo.sf_profil out c:\test.bcp /c /S(local) /Usa /Pabc123
but still was unable to run
the error message
DB-library error
unable to connect : SQL Server is unavailable does not existAre all three command lines failing? The first one seems to be referencing a server named "local" instead of the (local) server. Also, when in doubt, explicitly use the name of the local server.
Not to be completely anal-retentive but are the user and password valid and capable of accessing the database and objects?|||i need to get some data out from a SQL Server 6.5
i tried using the BCP
bcp iac.dbo.sf_profil out c:\test.bcp /c /Slocal /Usa /Pabc123
bcp iac.dbo.sf_profil out c:\test.bcp /c /Svots138svr09 /Usa /Pabc123
bcp iac.dbo.sf_profil out c:\test.bcp /c /S(local) /Usa /Pabc123
but still was unable to run
the error message
DB-library error
unable to connect : SQL Server is unavailable does not exist
In sql server 2000 ,
With default format,you could run
exec master..xp_cmdshell 'bcp test.dbo.jojo out c:\test.txt -c -T -Sservername -Usa -Psecrectcode'
Joydeep
BCP Question.
duplicate values. So I used something like ">bcp pubs.dbo.stores in
"stores.txt" -m 50..." assuming, the bcp stops only after encountering more
than 50 duplicate. But BCP stops whenever it encounters the first duplicate
value!!
How to continue with BCP, ignoring the duplicate values?
Thanks.
I think it would be best to bcp into a staging table and then do an insert
with a not in subquery keying off the pk.
Hilary Cotter
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
"Viga" <Viga@.discussions.microsoft.com> wrote in message
news:89E94705-F691-4DCD-8E9C-BAEEDDD5C722@.microsoft.com...
> Am using bcp to upload data files to sql server. The data file contains
some
> duplicate values. So I used something like ">bcp pubs.dbo.stores in
> "stores.txt" -m 50..." assuming, the bcp stops only after encountering
more
> than 50 duplicate. But BCP stops whenever it encounters the first
duplicate
> value!!
> How to continue with BCP, ignoring the duplicate values?
> Thanks.
2012年3月11日星期日
bcp help
Trying to run this command:
bcp Risk.dbo.tbl_Open in C:\temp2\2006.05.11-09.20.11.11\Risk\Open.txt
-T -n
getting the followin error message:
SQLState = 37000, Native Error = 156
Incorrect Syntax near the keyword 'Open'.
I can't not rename a table. Is there a work around?
Thanks,Are you executing this in Query Analyzer or from an operating system command prompt. BCP is not a
TSQL command. If you want to run a TSQL command, use BULK INSERT instead.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"tolcis" <a.liberchuk@.verizon.net> wrote in message
news:1147370866.716078.250460@.i40g2000cwc.googlegroups.com...
> Hi!
> Trying to run this command:
> bcp Risk.dbo.tbl_Open in C:\temp2\2006.05.11-09.20.11.11\Risk\Open.txt
> -T -n
> getting the followin error message:
> SQLState = 37000, Native Error = 156
> Incorrect Syntax near the keyword 'Open'.
> I can't not rename a table. Is there a work around?
> Thanks,
>|||I am executing from DOS command.|||That is strange since the error complain on the keyword Open where your code refers to a table named
tbl_Open. Anyhow, check out the -q option of bcp.exe.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in message
news:OmydNdSdGHA.3484@.TK2MSFTNGP04.phx.gbl...
> Are you executing this in Query Analyzer or from an operating system command prompt. BCP is not a
> TSQL command. If you want to run a TSQL command, use BULK INSERT instead.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
> "tolcis" <a.liberchuk@.verizon.net> wrote in message
> news:1147370866.716078.250460@.i40g2000cwc.googlegroups.com...
>> Hi!
>> Trying to run this command:
>> bcp Risk.dbo.tbl_Open in C:\temp2\2006.05.11-09.20.11.11\Risk\Open.txt
>> -T -n
>> getting the followin error message:
>> SQLState = 37000, Native Error = 156
>> Incorrect Syntax near the keyword 'Open'.
>> I can't not rename a table. Is there a work around?
>> Thanks,
>
bcp help
Trying to run this command:
bcp Risk.dbo.tbl_Open in C:\temp2\2006.05.11-09.20.11.11\Risk\Open.txt
-T -n
getting the followin error message:
SQLState = 37000, Native Error = 156
Incorrect Syntax near the keyword 'Open'.
I can't not rename a table. Is there a work around?
Thanks,Are you executing this in Query Analyzer or from an operating system command
prompt. BCP is not a
TSQL command. If you want to run a TSQL command, use BULK INSERT instead.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"tolcis" <a.liberchuk@.verizon.net> wrote in message
news:1147370866.716078.250460@.i40g2000cwc.googlegroups.com...
> Hi!
> Trying to run this command:
> bcp Risk.dbo.tbl_Open in C:\temp2\2006.05.11-09.20.11.11\Risk\Open.txt
> -T -n
> getting the followin error message:
> SQLState = 37000, Native Error = 156
> Incorrect Syntax near the keyword 'Open'.
> I can't not rename a table. Is there a work around?
> Thanks,
>|||I am executing from DOS command.|||That is strange since the error complain on the keyword Open where your code
refers to a table named
tbl_Open. Anyhow, check out the -q option of bcp.exe.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in
message
news:OmydNdSdGHA.3484@.TK2MSFTNGP04.phx.gbl...
> Are you executing this in Query Analyzer or from an operating system comma
nd prompt. BCP is not a
> TSQL command. If you want to run a TSQL command, use BULK INSERT instead.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
> "tolcis" <a.liberchuk@.verizon.net> wrote in message
> news:1147370866.716078.250460@.i40g2000cwc.googlegroups.com...
>
2012年3月6日星期二
BCP Error w/SQL 2005
command like this:
BCP Impresario.dbo.LFT_GL_POSTING(91) out c:\impftp\gl.txt -c -T -STESS3
The version of BCP.EXE that comes with SQL Server 2005 (2005.90.1399.0)
raises the following error when attempting this:
An error occurred while processing the command line.
Thanks for any help!
Adding my managed newsgroup email id.
Steven Bras
Tessitura Network, Inc.
"Tessitura Network, Inc." wrote:
> In SQL Server 2000, we were able to BCP out of a table-based function with a
> command like this:
> BCP Impresario.dbo.LFT_GL_POSTING(91) out c:\impftp\gl.txt -c -T -STESS3
> The version of BCP.EXE that comes with SQL Server 2005 (2005.90.1399.0)
> raises the following error when attempting this:
> An error occurred while processing the command line.
> Thanks for any help!
|||Try using the option of specifying a "query inside double quotes" in
place of just the the table name.
Roy Harvey
Beacon Falls, CT
On Wed, 21 Mar 2007 09:30:39 -0700, Tessitura Network, Inc. <Tessitura
Network, Inc.@.discussions.microsoft.com> wrote:
>In SQL Server 2000, we were able to BCP out of a table-based function with a
>command like this:
>BCP Impresario.dbo.LFT_GL_POSTING(91) out c:\impftp\gl.txt -c -T -STESS3
>The version of BCP.EXE that comes with SQL Server 2005 (2005.90.1399.0)
>raises the following error when attempting this:
> An error occurred while processing the command line.
>Thanks for any help!
|||Thanks! That solved the problem.
Steven Bras
Tessitura Network, Inc.
"Roy Harvey" wrote:
> Try using the option of specifying a "query inside double quotes" in
> place of just the the table name.
> Roy Harvey
> Beacon Falls, CT
> On Wed, 21 Mar 2007 09:30:39 -0700, Tessitura Network, Inc. <Tessitura
> Network, Inc.@.discussions.microsoft.com> wrote:
>
bcp error
c:\bcp test_db.dbo.table_1 out c:\test_db_new_table.dat -e c:\test_db_new_table.err -c -U sa -P abc
the result is:
SQLState = S1000, NativeError = 0
Error = [Microsoft][ODBC SQL Server Driver][SQL Server]Code page 862 is not supported by SQL Server
SQLState = S1000, NativeError = 0
Error = [Microsoft][ODBC SQL Server Driver]Unable to resolve column level collations
but when I execute the same script with "-f" option I do not have any problem
c:\bcp test_db.dbo.table_1 out c:\test_db_new_table.dat -e c:\test_db_new_table.err -U sa -P abc -f c:\bcp.fmt
how can I use the "-c" option when I want to execute BCP from the command line in batch mode
or is it just a problem in the settings of my SQL Server
10x in advanceOriginally posted by ranmel
when I use bcp with "-c" option I get the following error:
c:\bcp test_db.dbo.table_1 out c:\test_db_new_table.dat -e c:\test_db_new_table.err -c -U sa -P abc
the result is:
SQLState = S1000, NativeError = 0
Error = [Microsoft][ODBC SQL Server Driver][SQL Server]Code page 862 is not supported by SQL Server
SQLState = S1000, NativeError = 0
Error = [Microsoft][ODBC SQL Server Driver]Unable to resolve column level collations
but when I execute the same script with "-f" option I do not have any problem
c:\bcp test_db.dbo.table_1 out c:\test_db_new_table.dat -e c:\test_db_new_table.err -U sa -P abc -f c:\bcp.fmt
how can I use the "-c" option when I want to execute BCP from the command line in batch mode
or is it just a problem in the settings of my SQL Server
10x in advance
using:
bcp master.dbo.syscolumns out c:\t1.dat -ec:\t1.err -c -Utest -P -SIFOODSV
warning: -C difference form -c
2012年2月25日星期六
bcp command
I am using the bcp command to export a bulk text file into the database,
bcp elearning.dbo.BulkData in mobile.txt -c -t, -SZOHL-02 -Usa -P1234567890 -E
I have 6 fields in the table to which i am exporting data.
One field is numeric and i have to set the identity to yes,
It gives me an error string data trucncated. When i remove the identity field, i am able to export data.So, how do i tackle this prob?
I used the -E attribute to keep the identity .But still i get the error. The text file has comma seperated fields.
I am using sql server 2000
You have to import your data to a temp table or an intermediate table before moving the data to the table with IDENTITY because a text file will appear to have NULL primary key and IDENTITY which is a primary key cannot be NULL. And no it is not a bug but just the nature of a text file compared to tabular data in a database. Hope this helps.
bcp command
I am trying to run a .bat file with this bcp command.
BCP "database.dbo.state" OUT "C:\TEMP\state.dat" -SServerName -U"userid" -P"password" -m1 -n -a65536 -E -q
However, it is not producing me a file as I expected.
Is there any other configuration I need to set before it work?
Any help would appreciated.What error messages are being produced? I don't think I've seen BCP fail silently in years. Have you ever done a successful BCP against that SQL Server from the same client maching?
-PatP|||The error is: "Error in attempting to load a pair of translation tables."|||The error is: "Error in attempting to load a pair of translation tables."
Excuse me?
Is it not creating a file, or not creating a file as "expected'
Because if it's the latter and you expect to "see" data, you won't. It's in native format.
You need to lose the -n and use -c|||The error is: "Error in attempting to load a pair of translation tables."That is definitely not an error message generated by BCP. What other programs are you running that might have generated that message?
-PatP
bcp bulk upload
Can anyone help, I am trying to do bulk upload:
EG.
set @.BULK = 'bcp "DQ_Central.dbo.tbl_CLI_UPLOAD" in "' + @.file_path + '" -S' + @.Server + ' -U' + @.User + ' -P' + @.PSW
and am getting this output message
Enter the file storage type of field service_number [char]:
Any one have any ideas ?!? Thanks u for yr helpyou forgot to specify the input file type, - character or native (-c or -n).
but you, you can do the same thing with bulk insert. this way you won't have to through your @.BULK at xp_cmdshell and get completely frustrated with char(39).
2012年2月18日星期六
BCP Insert record error (SQL2005-Window 2003)
Hi All,
When we to inset record into the tables through BCP we are getting following errors.
C:\> bcp ACCT.dbo.dtpro out C:\test\dtpro_TA.dat -T-n
C:\>bcp ACCT.dbo.Semiaa out C:\test\Semiaa_TA.dat -T -n
BCP out works fine only BCP in have problems.
Please can you let me know how to resolved this problem.
===========
Exp - 1
===========
C:\> bcp ACCT.dbo.dtpro in C:\test\dtpro_TA.dat -T-n
Starting copy...
SQLState = HY000, NativeError = 0
Error = [Microsoft][SQL Native Client]Unexpected EOF encountered in BCP data-file
0 rows copied.
Network packet size (bytes): 4096
Clock Time (ms.) Total : 1
===========
Exp - 2
===========
C:\>bcp ACCT.dbo.Semiaa in C:\test\Semiaa_TA.dat -T -n
Starting copy...
SQLState = HY000, NativeError = 0
Error = [Microsoft][SQL Native Client]Unexpected EOF encountered in BCP data-file
0 rows copied.
Network packet size (bytes): 4096
Clock Time (ms.) Total : 1
============
Exp-3
============
C:\>bcp ACCT.dbo.SemiH in C:\test\SemiH_TA.dat -T -n
Starting copy...SQLState = HY000, NativeError = 0
Error = [Microsoft][SQL Native Client]Unexpected EOF encountered in BCP data-file
SQLState = 42000, NativeError = 7339
Error = [Microsoft][SQL Native Client][SQL Server]OLE DB provider 'STREAM' for l
inked server '(null)' returned invalid data for column '[!BulkInsert].Created'.
BCP copy in failed
Thanks in Advance
There are many reasons this error can happen. It could be, and often is, that the schemas of the databases are incompatible. Post a reply containing the schemas of these databases if you can. That would greatly help in diagnosing the problem.
Jay
|||
C:\>bcp ACCT.dbo.dtpro in C:\test\dtpro_TA.dat -T-n
Starting copy...
SQLState = HY000, NativeError = 0
Error = [Microsoft][SQL Native Client]Unexpected EOF encountered in BCP data-file
0 rows copied.
Network packet size (bytes): 4096
Clock Time (ms.) Total : 1
******************************************table dtpro
[id] [int] NULL,
[objectid] [int] NULL,
[property] [varchar](64) NULL,
[value] [varchar](255) NULL,
[uvalue] [nvarchar](510) NULL,
[lvalue] [image] NULL,
[version] [int]NULL,
********************************************
|||The error message typically indicates some sort of corruption in the file due to invalid lines, invalid terminators etc. Can you try to create a dummy file on a different location and try? If you are using the file that you BCPed out then do that again but to a different location and try.|||
The schema seems simple enough. It seems odd that you can't import into the same table you exported from, since your table doesn't contain fields that would preclude that.
I would try what Umachandar suggested, and if that doesn't work, try and isolate which records might be causing the problems by using the -F and -L options of bcp to export subsets.
|||Were you ever able to get this resolved?
Jay Kint