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

2012年3月27日星期二

BCP will delete '\' chars on insert of character data

I've discovered that when using BCP to insert character data, then for any s
equence '\' + <newline> (backslash + ASCII 13), the '\' character is strippe
d. For example, try inserting this:
"Hello\\n"
and you'll wind up with
"Hello\n"
Can I turn this behavior off, or is this a known bug in BCP?
I'm using BCP with the SQL Server 7 ODBC driver.
Thanks,
Jim FloodJim Flood wrote:

> I've discovered that when using BCP to insert character data, then for any
sequence '' + <newline> (backslash + ASCII 13), the '' character is strip
ped. For example, try inserting this:
> "Hello\\n"
> and you'll wind up with
> "Hello\n"
> Can I turn this behavior off, or is this a known bug in BCP?
> I'm using BCP with the SQL Server 7 ODBC driver.
> Thanks,
> Jim Flood|||Can you verify the version number of the ODBC driver? You can do this be
running the ODBC Administrator and looking for the Version for the "SQL
Server" driver on the Drivers tab. Or, you can check the version of
sqlsrv32.dll in your system32 directory using Explorer.
We tried this with an 8.0 ODBC Driver and it does not repro. Before I go
setup a machine with SQL 7.0 on it, I want to verify your version number, to
make sure I get the same version.
Brannon Jones
Developer - MDAC
This posting is provided "as is" with no warranties and confers no rights.
"Jim Flood" <anonymous@.discussions.microsoft.com> wrote in message
news:DA87D286-F669-4F74-A5E5-82A9CBDEE5BE@.microsoft.com...
> I've discovered that when using BCP to insert character data, then for any
sequence '' + <newline> (backslash + ASCII 13), the '' character is
stripped. For example, try inserting this:
> "Hello\\n"
> and you'll wind up with
> "Hello\n"
> Can I turn this behavior off, or is this a known bug in BCP?
> I'm using BCP with the SQL Server 7 ODBC driver.
> Thanks,
> Jim Flood|||The version number is 2000.81.9042.0. The sequence is backslash character, f
ollowed by newline character. Backslash followed by any other character does
not cause a problem.

2012年3月19日星期一

BCP Invalid character value

I am getting a 'Invalid character value for cast specification' error when
trying to BCP data from a SQL 8.00.760 instance to a SQL 9.00.2047 instance.
BCP out syntax...
exec master..xp_cmdshell 'BCP database..table in D:\Temp\database\table.txt
-e D:\Temp\database\table.err -b 1000 -c -S server\instance -U sa -P password
-E'
BCP in syntax...
exec master..xp_cmdshell 'BCP database..table in D:\Temp\database\table.txt
-e D:\Temp\database\table.err -b 1000 -c -S server\instance -U sa -P password
-E'
BCP error...
SQLState = 22005, NativeError = 0
Error = [Microsoft][ODBC SQL Server Driver]Invalid character value for cast
specification
The data in the column it's giving the error on is: 0xFFFFFF7F
John Oberlin (JohnOberlin@.discussions.microsoft.com) writes:
> I am getting a 'Invalid character value for cast specification' error
> when trying to BCP data from a SQL 8.00.760 instance to a SQL 9.00.2047
> instance.
> BCP out syntax...
> exec master..xp_cmdshell 'BCP database..table in
> D:\Temp\database\table.txt
> -e D:\Temp\database\table.err -b 1000 -c -S server\instance -U sa -P
> password -E'
> BCP in syntax...
> exec master..xp_cmdshell 'BCP database..table in
> D:\Temp\database\table.txt
> -e D:\Temp\database\table.err -b 1000 -c -S server\instance -U sa -P
> password -E'
> BCP error...
> SQLState = 22005, NativeError = 0
> Error = [Microsoft][ODBC SQL Server Driver]Invalid character value for
> cast specification
> The data in the column it's giving the error on is: 0xFFFFFF7F
And the data type of the column is?
Even better, what is the definition of the two tables? Specifically,
are they identical? Please script both tables and post together with
some sample data that demonstrates the problem.
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx

2012年3月11日星期日

BCP import error

I BCP out a table and then import back. While BCP IN, i get the following error:
#@. Row 303, Column 5: Invalid character value for cast specification @.#
#@. Row 296, Column 4: String data, right truncation @.#
Help plz!I think the data you try to insert into the table does not match the the ddl of the table itself. Are there any strange characters on row 303? What does row 303 look like anyway? The bcp-command you execute: does it consider strange characters and how does it map the file to the table? What's the layout of the table?|||Hi, thanx.
I don't suspect if there's any column binding problem, coz
I create a txt file from the same table, then truncate that table and import the data back from this text file.
The problem is multiple commas ",,," in the note-content column text.
Here's an example:

CREATE TABLE mydbo (id int, notedate datetime, note_content varchar(900), note_user char(3))
go
INSERT MYTAB
SELECT 1 , '2003-12-24 00:00:00' , 'AS PERINSTRUCTION ENTRD SC#@.12/16/03...71', 'SF2'
UNION ALL
SELECT 2 , '2004-02-07 00:00:00', 'CHECKED INF SCA@.#02/06/04.............17', 'SF2'
UNION ALL
SELECT 3 , '2004-03-26 00:00:00', 'GO TO, #, as per data .', 'SF2'

When i BCP out this table and then BCP into same table, i get the error for line 3. (right trucation)
How do i handle this, i have a CSV file that i have to import into a table, but data in single field contains multiple commas.

Howdy!|||Would it be possible for you to choose a different field seperator such as ; or [tab] ?

bcp import

I'd like to bcp import a file that sometimes misses the last column/s. There's an EOL character instead. For some reason, bcp wraps around, ignoring the EOL character, and continues reading from the next row of the file. Instead, I'd like to replace the missing columns by null.

I've tried using bcp, bulk insert and the DTS Wizard. So far, I've only been succesfull using the DTS Wizard. I also do some other bcp imports, so I'd like to stick with bcp.

bcp table1 in myFile.csv -SServer1 -T -c -k -t\t -r\n

myFile.csv looks like... (replaced tabs by ;)
Col001;Col002;Col003;Col004
Col001;Col002
Col001;Col002;Col003
Col001;Col002;Col003;Col004
etc

are imported as:
Col001;Col002;Col003;Col004
Col001;Col002;Col001;Col002
Col001;Col002;Col003;Col001
etc

Any suggestions?if you want to insert null for column3 and column 4 then only specify the separator
Col001;Col002;Col003;Col004
Col001;Col002;;
Col001;Col002;Col003
Col001;Col002;Col003;Col004|||Not specifing the row terminator doesn't make a difference. bcp still regards the \n as just another character to import, at least, on my system.|||...it sounds like the terminator in your file is the problem...on what system was the input file generated? (unix?) This might cause new lines to be unreadable on Windows...|||The file has lf as row-terminator, but I guess it wont be a problem changing that into cr/lf. The lf is readable for those rows that match the layout of the table. It's the rows that don't match that are wrapped. As far as I can see now, either the file will have to include empty values instead of nothing or I'll have to divide the proces in smaller processes.

2012年2月25日星期六

BCP delivery the: character

Using the BCP utility ->

With a degree character in the flat data file, can anyone deliver this to a table without SQL Server changing it to stacked bar:

CREATE TABLE "dbo"."F_conv"
(
"col1" VARCHAR(21) NOT NULL
)
;

myformat.fmt

8.0
1
1 SQLCHAR 0 30 "\r\n" 1 col1 ""

mydata.dat file

1332 NS 4 Tall 32 oz

bcp command

bcp "MY_DB"."dbo"."F_conv" in "mydata.dat"
-q -S<server> -Usa -Psa -f"myformat.fmt"I don't think declaring the column as VARCHAR(...) will satisfy your requirements. I changed your sample to NVARCHAR(32) for the column and got a little closer (char(166) instead of char(176) for the degree sign) and then was able to perform a REPLACE on the column. I am pretty sure you also need to address collation of the column to ensure that your data gets imported correctly.|||Try taking BCP out of the picture, and use:CREATE TABLE dbo.tDstachon (
col1 CHAR(21) NOT NULL
)
GO

BULK INSERT dbo.tDstachon FROM 'c:\dstachon.txt'
BULK INSERT dbo.tDstachon FROM 'c:\dstachon.txt' WITH (CODEPAGE = 'ACP')

SELECT * FROM dbo.tDstachon-PatP|||thanks guys.

cheers,
d.

BCP DB Library functions

Hi,
We are using the DB-Library functions in a C++ program to do a BCP out of
SQL Server and are having a problem getting it to output character data.
When using the batch BCP utility there is the -c option which outputs the
information as character data. Is it possible to set this option with the
available DB-Library functions, or some other way? bcp_init does not seem
to have the full set of options that are available in the batch utility.
Thanks in advance for any help.
Wayne AntinoreWayne Antinore (wantinore@.veramark.com) writes:
> We are using the DB-Library functions in a C++ program to do a BCP out of
> SQL Server and are having a problem getting it to output character data.
> When using the batch BCP utility there is the -c option which outputs the
> information as character data. Is it possible to set this option with the
> available DB-Library functions, or some other way? bcp_init does not seem
> to have the full set of options that are available in the batch utility.
You have access to all features that the command-line interface provides,
they are just more difficult to use. When using the API, you need to think
in terms of format files, no matter you if specify data format as such,
or if you define columns programmatically with bcp_colfmt. -c and -n are
just shortcuts for special cases format files.
The bcp functions are described in Books Online, but the documentation
is a bit obscure in places, not the least the one bcp_colfmt. I know,
I had a hard time to understand it myself. I have a Perl module for DB-Lib
which include the DB-Library routines, and even if you use C++, you may find
my documentaion helpful, see http://www.sommarskog.se/mssqlperl/mssql-
dblib.html#bcp_routines.
By the way, why DB-Library? In my opinion, DB-Library is a very good
client library, but alas Microsoft does not agree with me and has
deprecated it, and has not added support for the new datatypes in SQL7
and later. You should probably use ODBC or OLE DB instead. (Which I'm
told have a very similar bulk-copy interface to DB-Library.)
--
Erland Sommarskog, SQL Server MVP, sommar@.algonet.se
Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinfo/productdoc/2000/books.asp|||Thanks Erland,
Since we were only putting out one column we formatted for the column and
all works well. We were still using DB-Library because this was an addition
to a component that already was using it so we were sticking with what we
knew (or thought we did!) .
Thanks, again.
Wayne
"Erland Sommarskog" <sommar@.algonet.se> wrote in message
news:Xns948AA27345CCYazorman@.127.0.0.1...
> Wayne Antinore (wantinore@.veramark.com) writes:
> > We are using the DB-Library functions in a C++ program to do a BCP out
of
> > SQL Server and are having a problem getting it to output character data.
> > When using the batch BCP utility there is the -c option which outputs
the
> > information as character data. Is it possible to set this option with
the
> > available DB-Library functions, or some other way? bcp_init does not
seem
> > to have the full set of options that are available in the batch utility.
> You have access to all features that the command-line interface provides,
> they are just more difficult to use. When using the API, you need to think
> in terms of format files, no matter you if specify data format as such,
> or if you define columns programmatically with bcp_colfmt. -c and -n are
> just shortcuts for special cases format files.
> The bcp functions are described in Books Online, but the documentation
> is a bit obscure in places, not the least the one bcp_colfmt. I know,
> I had a hard time to understand it myself. I have a Perl module for DB-Lib
> which include the DB-Library routines, and even if you use C++, you may
find
> my documentaion helpful, see http://www.sommarskog.se/mssqlperl/mssql-
> dblib.html#bcp_routines.
> By the way, why DB-Library? In my opinion, DB-Library is a very good
> client library, but alas Microsoft does not agree with me and has
> deprecated it, and has not added support for the new datatypes in SQL7
> and later. You should probably use ODBC or OLE DB instead. (Which I'm
> told have a very similar bulk-copy interface to DB-Library.)
> --
> Erland Sommarskog, SQL Server MVP, sommar@.algonet.se
> Books Online for SQL Server SP3 at
> http://www.microsoft.com/sql/techinfo/productdoc/2000/books.asp

BCP DB Library functions

Hi,
We are using the DB-Library functions in a C++ program to do a BCP out of
SQL Server and are having a problem getting it to output character data.
When using the batch BCP utility there is the -c option which outputs the
information as character data. Is it possible to set this option with the
available DB-Library functions, or some other way? bcp_init does not seem
to have the full set of options that are available in the batch utility.
Thanks in advance for any help.
Wayne AntinoreWayne Antinore (wantinore@.veramark.com) writes:
> We are using the DB-Library functions in a C++ program to do a BCP out of
> SQL Server and are having a problem getting it to output character data.
> When using the batch BCP utility there is the -c option which outputs the
> information as character data. Is it possible to set this option with the
> available DB-Library functions, or some other way? bcp_init does not seem
> to have the full set of options that are available in the batch utility.
You have access to all features that the command-line interface provides,
they are just more difficult to use. When using the API, you need to think
in terms of format files, no matter you if specify data format as such,
or if you define columns programmatically with bcp_colfmt. -c and -n are
just shortcuts for special cases format files.
The bcp functions are described in Books Online, but the documentation
is a bit obscure in places, not the least the one bcp_colfmt. I know,
I had a hard time to understand it myself. I have a PERL module for DB-Lib
which include the DB-Library routines, and even if you use C++, you may find
my documentaion helpful, see http://www.sommarskog.se/mssqlperl/mssql-
dblib.html#bcp_routines.
By the way, why DB-Library? In my opinion, DB-Library is a very good
client library, but alas Microsoft does not agree with me and has
deprecated it, and has not added support for the new datatypes in SQL7
and later. You should probably use ODBC or OLE DB instead. (Which I'm
told have a very similar bulk-copy interface to DB-Library.)
Erland Sommarskog, SQL Server MVP, sommar@.algonet.se
Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp|||Thanks Erland,
Since we were only putting out one column we formatted for the column and
all works well. We were still using DB-Library because this was an addition
to a component that already was using it so we were sticking with what we
knew (or thought we did!) .
Thanks, again.
Wayne
"Erland Sommarskog" <sommar@.algonet.se> wrote in message
news:Xns948AA27345CCYazorman@.127.0.0.1...
> Wayne Antinore (wantinore@.veramark.com) writes:
of
the
the
seem
> You have access to all features that the command-line interface provides,
> they are just more difficult to use. When using the API, you need to think
> in terms of format files, no matter you if specify data format as such,
> or if you define columns programmatically with bcp_colfmt. -c and -n are
> just shortcuts for special cases format files.
> The bcp functions are described in Books Online, but the documentation
> is a bit obscure in places, not the least the one bcp_colfmt. I know,
> I had a hard time to understand it myself. I have a PERL module for DB-Lib
> which include the DB-Library routines, and even if you use C++, you may
find
> my documentaion helpful, see http://www.sommarskog.se/mssqlperl/mssql-
> dblib.html#bcp_routines.
> By the way, why DB-Library? In my opinion, DB-Library is a very good
> client library, but alas Microsoft does not agree with me and has
> deprecated it, and has not added support for the new datatypes in SQL7
> and later. You should probably use ODBC or OLE DB instead. (Which I'm
> told have a very similar bulk-copy interface to DB-Library.)
> --
> Erland Sommarskog, SQL Server MVP, sommar@.algonet.se
> Books Online for SQL Server SP3 at
> http://www.microsoft.com/sql/techin.../2000/books.asp

BCP Converting character ° to ¦

A BCP process is converting a degree character (°) to a pipe character (¦).
This is the only conversion problem that has been identified. Is there a
method to correct this?Try adding -C RAW' to your BCP command. This will prevent code page
conversion.
--
Hope this helps.
Dan Guzman
SQL Server MVP
"KingRo" <KingRo@.discussions.microsoft.com> wrote in message
news:A0D44DC3-915F-45B8-9BD1-EF16DCA4865D@.microsoft.com...
>A BCP process is converting a degree character (°) to a pipe character (¦).
> This is the only conversion problem that has been identified. Is there a
> method to correct this?

BCP character conversion

I bcped in data into a database with SQL_Latin1_General_Cp1_CI_AS collation. The input data has an embedded character (ascii 174). I did not specify any code page using the -C parm. The data was converted to character (ascii 171). I ran the bcp trying -C1252 and -CRAW and both maintained the correct character. -C437 and -COEM change the character to .
Why did this happen? I thought that data would be converted to correctly without any code page specification.Different code pages map binary values to glyphs (the graphic symbols that humans know and love) differently. One binary value can map to many different glyphs using different code pages.

If BPC doesn't know which code page to use for translation, you get "pot luck", especially for characters that aren't well defined. Typically, you want the code page that created the data. Occaisionally, you want the code page that was intended (or at least used) to view the data. Because of the pot-pouri of mappings supported by the different code pages, the business of getting data from point A to point B has grown yet another potentially "interesting" twist to amuse those of us that do the moving!

-PatP|||Thanks for the quick reply.
BOL states:
"When bulk copying data using native or character format, bcp, by default, converts character data to:

OEM code page characters when exporting data from an instance of Microsoft SQL Server.

ANSI/Microsoft Windows code page characters when importing data into an instance of SQL Server. "

So wouldn't the bcp in use code page 1252 by default. This should be similar to -C1252.|||Well where did the data come from?|||The bcp ran from my workstation with a code page 437 - if that's your question.|||From Books Online topic bcp: "OEM Default code page used by the client. This is the default code page used by bcp if -C is not specified."
From that I suppose that SQL Server interpreted your file as being OEM 437 CP. mojza|||I guess I still don't understand why the character was changed during the bcp. I can view it correctly from my workstation which is 437, but if I bcp using -C437 or without -C(which uses default OEM code page) it gets converted. I think I'm missing something.|||In what editor can you see that character correctly? in ANSI (e.g.Notepad) or in OEM (e.g.Edit)? mojza|||Correctly in notepad or textpad, not correctly in edit. So bcp, running in a command window, is using 437 which changes the character to ?|||Then, in my opinion, your file was created in code page ANSI 1252 (notepad ok) and bcp interprets your file as cp 437 (default client OEM code page). That leads to a loss of some extended characters that are not compatible between these two pages unless you tell sql server to interpret him as 1252 or without any translation (RAW). Check out this Microsoft article. There is a good explanation and excellent examples. mojza

http://support.microsoft.com/default.aspx?scid=kb;en-us;199819|||Thanks for your help. That article definitely helped explain things. I also looked at the nls files for 437 and 1252 and character 174(offset x0178) reflects in the 1252 file and int 437 file.
Again, thanks.

2012年2月23日星期四

bcp and invalid character value set

Hello
I've read that there is a bug in sql server 2000 when doing a bcp command
with dates in dd-mm-yyyy format. and to fix it there is a hotfix contained
in sp4 . I ve installed the sp4 but the bug remains anybody has an idea
about this hotfix and from where we can get it
thx
Hi
Can you point to where there is a reference to this "bug"?
The -R flag will use the regional setting of the client machine and there
was a fix in SP1 where this was being ignored.
You will need to make sure that you also have the correct version of the
client tools on the machine that you are using.
John
"Pascal Haddad" <ph@.sabaipc.com> wrote in message
news:u8LAsf6qFHA.3096@.TK2MSFTNGP15.phx.gbl...
> Hello
> I've read that there is a bug in sql server 2000 when doing a bcp command
> with dates in dd-mm-yyyy format. and to fix it there is a hotfix contained
> in sp4 . I ve installed the sp4 but the bug remains anybody has an idea
> about this hotfix and from where we can get it
> thx
>
>

bcp and invalid character value set

Hello
I've read that there is a bug in sql server 2000 when doing a bcp command
with dates in dd-mm-yyyy format. and to fix it there is a hotfix contained
in sp4 . I ve installed the sp4 but the bug remains anybody has an idea
about this hotfix and from where we can get it
thxHi
Can you point to where there is a reference to this "bug"?
The -R flag will use the regional setting of the client machine and there
was a fix in SP1 where this was being ignored.
You will need to make sure that you also have the correct version of the
client tools on the machine that you are using.
John
"Pascal Haddad" <ph@.sabaipc.com> wrote in message
news:u8LAsf6qFHA.3096@.TK2MSFTNGP15.phx.gbl...
> Hello
> I've read that there is a bug in sql server 2000 when doing a bcp command
> with dates in dd-mm-yyyy format. and to fix it there is a hotfix contained
> in sp4 . I ve installed the sp4 but the bug remains anybody has an idea
> about this hotfix and from where we can get it
> thx
>
>

bcp and invalid character value set

Hello
I've read that there is a bug in sql server 2000 when doing a bcp command
with dates in dd-mm-yyyy format. and to fix it there is a hotfix contained
in sp4 . I ve installed the sp4 but the bug remains anybody has an idea
about this hotfix and from where we can get it
thx
Do you have anything more specific on this? What is the behavior that is
failing?
| From: "Pascal Haddad" <ph@.sabaipc.com>
| Subject: bcp and invalid character value set
| Date: Sat, 27 Aug 2005 21:33:25 +0200
| Lines: 9
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| X-RFC2646: Format=Flowed; Original
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| Message-ID: <#GfznXzqFHA.3352@.TK2MSFTNGP14.phx.gbl>
| Newsgroups: microsoft.public.sqlserver.odbc
| NNTP-Posting-Host: 213.175.179.18
| Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGP14.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl microsoft.public.sqlserver.odbc:2623
| X-Tomcat-NG: microsoft.public.sqlserver.odbc
|
| Hello
|
| I've read that there is a bug in sql server 2000 when doing a bcp command
| with dates in dd-mm-yyyy format. and to fix it there is a hotfix
contained
| in sp4 . I ve installed the sp4 but the bug remains anybody has an idea
| about this hotfix and from where we can get it
| thx
|
|
|

bcp and invalid character value set

Hello
I've read that there is a bug in sql server 2000 when doing a bcp command
with dates in dd-mm-yyyy format. and to fix it there is a hotfix contained
in sp4 . I ve installed the sp4 but the bug remains anybody has an idea
about this hotfix and from where we can get it
thxDo you have anything more specific on this? What is the behavior that is
failing?
| From: "Pascal Haddad" <ph@.sabaipc.com>
| Subject: bcp and invalid character value set
| Date: Sat, 27 Aug 2005 21:33:25 +0200
| Lines: 9
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| X-RFC2646: Format=Flowed; Original
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| Message-ID: <#GfznXzqFHA.3352@.TK2MSFTNGP14.phx.gbl>
| Newsgroups: microsoft.public.sqlserver.odbc
| NNTP-Posting-Host: 213.175.179.18
| Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP14.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl microsoft.public.sqlserver.odbc:2623
| X-Tomcat-NG: microsoft.public.sqlserver.odbc
|
| Hello
|
| I've read that there is a bug in sql server 2000 when doing a bcp command
| with dates in dd-mm-yyyy format. and to fix it there is a hotfix
contained
| in sp4 . I ve installed the sp4 but the bug remains anybody has an idea
| about this hotfix and from where we can get it
| thx
|
|
|

2012年2月18日星期六

BCP - Hint exceeds

Query hints exceed maximum command buffer size of 1023 bytes(1029 bytes input).
i tried a long query in BCP because i have to insert a character to one of its fields.
hope somebody had encountered and solved this (sql server 2000). thanks in advance..what's your bcp command line?|||here...

bcp "Select 'A'+Customer_Code, PFW_Customer_Code, Newsys_Customer_Code, SBT_Customer_Code, BM_Customer_Code,

Customer_Class_Code, Customer_Company_Name, Customer_Market_Name, Contact_Person_Name, Contact_Person_Position,

Contact_Person_Contact_Number, Contact_Person_Fax_Number, Contact_Person_Email_Address, Customer_Delivery_Address,

Customer_Market_Type_Code, Customer_Market_Cluster_Code, Customer_Level_Code, Customer_Location_Code,

Customer_Route_Name, Customer_CreditLimit, Customer_Status, Customer_Status_Decription, Customer_Auto_Approve,

Customer_Set_Code, Customer_Receipt_Type, Customer_Outstanding_Balance, Customer_Available_Balance,

Customer_Last_Order_Date, Customer_Last_Order_Amount, NewSys_Customer_Salesman_Code, OnHold_Status, OnHold_Date,

OnHold_Remarks, AR_CashAccountCode, AR_CashAccountDesciption, Create_User_Code, Create_Date, Modify_User_Code,

Modify_Date, Status, SpareField1, SpareField2, Remarks1, Remarks2, newsys_terms_fpm, newsys_terms_gp,

newsys_terms_ham from CDO_MAIN..GenMKT_Customer_Masterfile" out c:\GenMKT_Customer_Masterfile.txt -t, -f

c:\GenMKT_Customer_Masterfile.xml -S10.10.1.8 -Usa -Psa|||Perhaps you could make that into a view in SQL Server, and just bcp out the view?|||you should be using queryout, not out.|||wrong code, i already replaced it with queryout but still fails...thus view in sql server runs bcp?|||in that case I would do as mcrowley suggests. create a view, and then run this bcp:

bcp CDO_MAIN..YourView out c:\GenMKT_Customer_Masterfile.txt -t, -f c:\GenMKT_Customer_Masterfile.xml -S10.10.1.8 -Usa -Psa|||Thanks a lot MCrowley & jezemine!!!|||-Usa -Psa
But first you should change the sa-password, put it in a vault somewhere and only use it in emergencies... :angel: