2012年3月8日星期四

bcp from a named instance

The instalation has SS2K as default instance and SS2K5 as a named instance.
When runing the following where the db is on the SS2K5 instance:
bcp <dbname.dbo.tablename> format nul -T -n -f <filename>.fmt
I get the following:
SQLState=37000,NativeError=4060
Error=[Microsoft][ODBC SQLServer Driver][SQL Server]Cannot open database
requested in login '<dbname>'. Login fail.
When I add the SS2K5 server name I get the same error.
However when I run bcp against a table on the default instance it runs.
Does bcp only look at the default instance'
--
Thanks in advance
GHUse the -S server_name\Instance_name option to connect to a non-default
instance.
Tom
"GH" <vakar@.community.nospam> wrote in message
news:A5B00431-8DE2-4935-9C4F-9BAF7217B02F@.microsoft.com...
> The instalation has SS2K as default instance and SS2K5 as a named
> instance.
> When runing the following where the db is on the SS2K5 instance:
> bcp <dbname.dbo.tablename> format nul -T -n -f <filename>.fmt
> I get the following:
> SQLState=37000,NativeError=4060
> Error=[Microsoft][ODBC SQLServer Driver][SQL Server]Cannot open database
> requested in login '<dbname>'. Login fail.
> When I add the SS2K5 server name I get the same error.
> However when I run bcp against a table on the default instance it runs.
> Does bcp only look at the default instance'
> --
> Thanks in advance
> GH|||GH (vakar@.community.nospam) writes:
> The instalation has SS2K as default instance and SS2K5 as a named
> instance.
> When runing the following where the db is on the SS2K5 instance:
> bcp <dbname.dbo.tablename> format nul -T -n -f <filename>.fmt
> I get the following:
> SQLState=37000,NativeError=4060
> Error=[Microsoft][ODBC SQLServer Driver][SQL Server]Cannot open database
> requested in login '<dbname>'. Login fail.
> When I add the SS2K5 server name I get the same error.
> However when I run bcp against a table on the default instance it runs.
As Tom said, you need to specify the server as MACHINE\Instance or
.\Instance.
If you are generating the BCP command from within SQL Server and
execute it wityh help xp_cmdshell, get the servername from @.@.servername.
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx|||Thanks for Tom's input.
Hi GH,
I agree with Tom that you can use the "-S" option to specify the
non-default server instance name. e.g.
bcp AdventureWorks.Sales.Currency out Currency.dat -S
remote-server-name\sql2005instance -T
Regards,
Steven Cheng
Microsoft Online Community Support
========================================
==========
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.)|||Hi GH,
How are you doing on this issue or does the suggestion in our replies help
you a little? If there is still anything we can help, please feel free to
post here.
Regards,
Steven Cheng
Microsoft Online Community Support
========================================
==========
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.)

没有评论:

发表评论