Using bcp to connect to SQL 2005 Express named instance
Posted on 2010-09-21
I have multiple SQL Express installations on a machine (as well as a SQL 2008 installation)
On the SQL Express named instance that I wish to bcp into (e.g. MyInstance), I have attached a database and the database is appearing under management studio as e.g. "C:\SQL\Data\MyDB.dbf"
The instance is set to mixed mode authentication and I can connect to the instance in SQL Server Management Studio using Windows Authentication. Note that the database name of the attached database is showing as "C:\SQL\Data\MyDB.mdf" listed under Databases in the SQL 2005 Express instance.
So I try to bcp in using the following command:
bcp MyDB.dbo.Test in "c:\SQL\Data\Test.txt" -c -S MyPC\MyInstance -T
but I get:
SQLState = 37000, NativeError = 4060
Error = [Microsoft][SQL Native client][SQL Server]Cannot open database "MyDB" requested by the login. The login failed.
SQLState = 28000, NativeError = 18456
Error = [Microsoft][SQL Native client][SQL Server]Login failed for user 'MyDomain\myuser\'
Can somebody please provide me with the correct parameters to use for this bcp operation.