SQL Server I can't use a database in SQL Azure

2wnc66cl  于 2023-03-07  发布在  其他
关注(0)|答案(4)|浏览(300)

I am trying to use a Database in SQL Azure. I have installed SQL Server 2008. I can Login SQL Azure and can use master Database. But I can't use other Database and I can't see any things in my object explorer. It shows this error:

"USE statement is not supported to switch between databases. Use a new connection to connect to a different Database."

How can I use another database?

zzlelutf

zzlelutf1#

You cannot link to another database server from SQL Azure, whether that other database is SQL Server or SQL Azure.

yiytaume

yiytaume2#

I found the Solution for this problem . I install SQL Server 2008 R2 . then every thing is ok...

6g8kf2rb

6g8kf2rb3#

  1. You can first create only the database before running the whole script to create schemas & Tables.
  2. Then manually change the database to the new DB that was created.
  3. Run the rest of the script. Do not run Use <databasename>
wxclj1h5

wxclj1h54#

as noted in above comment with Azure SQL server just supply the database as parm to sqlcmd ... as per this bash sqlcmd command

export curr_domain=emmasqlserver.database.windows.net # my azure SQL server name
export SQLCMDPASSWORD=$sql_server_pwd
sqlcmd -S $curr_domain   -U $username_srv -d TestDB -i  ./sql/somesqlhere.sql

NOTE in above the -d TestDB which is how you choose which db

相关问题