SqlBulkCopy.WriteToServer SqlException

  • Thread starter Thread starter harleedavidson
  • Start date Start date
H

harleedavidson

Using SqlBulkCopy.WriteToServer to upload a datatable and getting:

System.Data.SqlClient.SqlException
Line 1: Incorrect syntax near 'COLLATE'.

Database Server is SQL2000, database in in 6.5 compatibility mode.

No error when targeting SQL2000 database in 8.0 compatibility mode.

Is this specific to 6.5 and is there a workaround?

thanks,
scott
 
Found a workaround:

If databases on same server, connect to 8.0 database, and preface the
SqlBulkCopy table name with the 6.5 database name.

example:
string connectionString = "Data Source=MySQLServer2000;Initial
Catalog=database80;Integrated Security=True";
using (SqlBulkCopy bcp = new SqlBulkCopy(connectionString))
{
bcp.DestinationTableName = "database65..destination_table";
bcp.WriteToServer(mydatatable);
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top