Questions tagged [default-database]

11 questions
183
votes
13 answers

How to change default database in SQL Server without using MS SQL Server Management Studio?

I dropped a database from SQL Server, however it turns out that my login was set to use the dropped database as its default. I can connect to SQL Server Management Studio by using the 'options' button in the connection dialog and selecting 'master'…
Martin Brown
  • 24,692
  • 14
  • 77
  • 122
13
votes
4 answers

Find out current database name (MSSQL)

If I want to know the server I can use: @@SERVERNAME Is there an equivalent function for getting database/catalog name. I know that we can set it in the script with USE statement but what if it wasnt set and I wanted to query within a sproc what db…
logixologist
  • 3,694
  • 4
  • 28
  • 46
3
votes
1 answer

Setting Default Database in Root Directory

This may be an insanely easy thing to do, but I'm completely lost. I'm working off of a server which is currently hosting two websites: the older site, and the newer wordpress site. The default database on the server is currently for the older site…
Audrey
  • 31
  • 2
3
votes
1 answer

SELECT from default catalog of linked server

I was able to create an alias for a linked server using this method. While linking the server I specified default catalog so now I can execute remote SP by skipping schema and Database name e.g. this works: EXEC…
Yuriy Galanter
  • 38,833
  • 15
  • 69
  • 136
1
vote
2 answers

Retrieving default database connection string in code

I am working with the existing structures used by the dev team at my current company. In order to change connection strings within the application, the team creates an XML node called "defaultDatabase" (see below): …
alybaba726
  • 390
  • 4
  • 14
1
vote
2 answers

how to have existing data in coredata ENTITY before the app launches

In my iOS app - I have something called settings where I set the priority for X , Y ,Z ; eg: X = 30, Y = 60 , Z = 80. which have some default value (X=50,Y=50 and Z =50) for the first time and untill user changes it to desired value. Basically user…
1
vote
1 answer

Protecting system databases in Sql Server Management Studio?

For the five hundredth time, I ran a sql script in management studio to add some tables to a database and FORGOT TO CHANGE THE DATABASE IT RUNS AGAINST. Since it defaults to master, I had to go and drop all the new tables I just added. I…
user1228
1
vote
2 answers

How to add initial or default data in App Engine

Hey guys kind of a n00b in App engine and I have been strugling with this is there a way that I can add/bulk default data to Data Store. I would like to create catalogs or example data, as well user or permission. I am not using the default App…
Necronet
  • 6,704
  • 9
  • 49
  • 89
0
votes
1 answer

C# console attempts to override the app.config value for the Default Database used by DatabaseFactory doesn't keep the change..CreateDatabase()

I need to override the DefaultDatabase value in the app.config used by DatabaseFactory.CreateDatabase() of DAAB I have the code below, and it indicates the change succeeds, but when I reference the default database later in the code, it no longer…
user825374
  • 21
  • 1
  • 3
0
votes
1 answer

How to get default database name using Transact-SQL query?

My initial concern was to DROP DATABASE MyDB when a certain condition is met but I get this error: Database 'MyDB' is still in use So, the answer I found was to do USE master DROP DATABASE MyDB It works, but for my case there is no guarantee…
Lelouch
  • 37
  • 4
0
votes
1 answer

How to connect to other databases (1 to 15) than default database (0) in stackexchange redis?

I have 3 applications pointing to single redis endpoint. I want to use separate redis database per application. But when I am trying to set defaultDatabase to 1 or 2 in ConfigurationOption it is still using database 0. I am using stackexchange…