Drop Table

Support Forum for database administrators and web based access to important newsgroups related to databases
Register on Database Support Forum Edit your profileCalendarFind other Database Support forum membersFrequently Asked QuestionsSearch this forum -> 
For Database admins: Free Database-related Magazines Now Free shipping to Texas


Post New Thread










Thread
Author

Problem using BCP
Hello,

I have the following scenario: I need to migrate several SQL Server tables
to MySQL 5. The tables have aprox. 2'000.000 so i need to use the SQL Server
BCP program because is the fastest.

The problem is with the Null handling. With BCP the Null is a '' empty
string. In my case i'm separating the fields by commas so ",," this would
represent a NULL value.

But with the "Load data infile" in MySQL the NULL value is represented by
this "\N"...

Has anyone resolved this incompatibility? Is there a way to configure BCP to
write the null values as \N ???

How can I handle this NULL incompatibility without editing the resulting
file, because it is several MB in size.

Thank you for your help.

Eduardo Sicouret



Report this thread to moderator Post Follow-up to this message
Old Post
Eduardo Sicouret
01-26-06 09:53 PM


Re: Problem using BCP
since you can use a table, view, or query as your bcp source, you may
be able to specify a SQL statement for your bulk export where you use
isNull(columnName, '\N') on all the columns with potential null values.
Along the same lines, you could also create a view that does the NULL
replacement and use the view for your bcp source

Try the bcp utility entry in BOL


Report this thread to moderator Post Follow-up to this message
Old Post
KenJ
01-27-06 01:23 AM


Re: Problem using BCP
Thank you for answering...

This works fine for string datatypes.  but what could I do with numeric and
date datatypes???

Eduardo

"KenJ" <kenjohnson@hotmail.com> escribió en el mensaje
news:1138326809.037866.75220@g47g2000cwa.googlegroups.com...
> since you can use a table, view, or query as your bcp source, you may
> be able to specify a SQL statement for your bulk export where you use
> isNull(columnName, '\N') on all the columns with potential null values.
> Along the same lines, you could also create a view that does the NULL
> replacement and use the view for your bcp source
>
> Try the bcp utility entry in BOL
>



Report this thread to moderator Post Follow-up to this message
Old Post
Eduardo Sicouret
01-30-06 04:23 PM


Re: Problem using BCP
Since they're just going into a text file anyway, maybe you could just
cast those fields to varchar...

SELECT Isnull(Cast(@int AS varchar(500)),'\N')


Report this thread to moderator Post Follow-up to this message
Old Post
KenJ
01-31-06 01:23 AM


Re: Problem using BCP
Since they're just going into a text file anyway, maybe you could just
cast those fields to varchar...

SELECT Isnull(Cast(@int AS varchar(500)),'\N')


Report this thread to moderator Post Follow-up to this message
Old Post
KenJ
01-31-06 01:23 AM


Sponsored Links





Last Thread Next Thread
Post New Thread

MS SQL Server archive

Show a Printable Version Email This Page to Someone! Receive updates to this thread
Microsoft SQL Server
Access database support
PostgreSQL Replication
SQL Server ODBC
FoxPro Support
PostgreSQL pgAdmin
SQL Server Clustering
MySQL ODBC
Web Applications with dBASE
SQL Server CE
MySQL++
Sybase Database Support
MS SQL Full Text Search
PostgreSQL Administration
SQL Anywhere support
DB2 UDB Database
Paradox Database Support
Filemaker Database
Berkley DB
SQL 2000/2000i database
ASE Database
Forum Jump:
All times are GMT. The time now is 04:10 AM.

 
Mobile devices forum | Database support forum archive




Copyrights DropTable.com Database Support Forum 2004 - 2006