About 50 results
Open links in new tab
  1. sql server - How can I do something like: USE @databaseName - Stack ...

    Sep 24, 2010 · Instead of dynamic SQL to do the equivalent of USE @Database, may I submit that some "pre-processed dynamic SQL" could be an even better solution for you? Of course, it depends …

  2. sql server - sql use statement with variable - Stack Overflow

    It appears SSMS validates the existence of the database for all USE statements in the script, even if those lines aren't executed. I was trying a variant of: IF @@SERVERNAME = 'UAT_Server' BEGIN …

  3. In SQL Server, like "use <<DatabaseName>>", how to "use …

    Oct 30, 2019 · A server instance can host a number of different databases. The USE Database command allows you to tell Sql Server which database in that instance to use. A corresponding USE …

  4. using "USE" keyword Vs. full table name in T-SQL

    Feb 18, 2014 · I'd tend to use [server].[database].[schema].[table] in instances where a script may query mutliple tables from multiple databases. The USE [database] would typically be used in scenarios …

  5. sql - EXEC to USE Database - Stack Overflow

    Sep 2, 2014 · DECLARE @Use VARCHAR(50) SET @Use = 'USE ' + @NewDatabaseName EXEC(@Use) Running it manually - the database doesn't get 'USED'. How can I execute the USE …

  6. Function like USE to point to a SQL database on a different server?

    In SQL Server, you can apply the use function to point a query to another database. For example: USE databasename GO; Is there a function that allows you to point to a different database server ...

  7. database - When to begin T-SQL query with USE? - Stack Overflow

    Jan 4, 2010 · The USE statement changes the current database for the connection, so if one statement expects to run in the MyDatabase database (but doesn't specify it with a USE MyDatabase …

  8. SQL-Server: Error - Exclusive access could not be obtained because the ...

    Dec 17, 2019 · Msg 3101, Level 16, State 1, Line 3 Exclusive access could not be obtained because the database is in use. Msg 3013, Level 16, State 1, Line 3 RESTORE DATABASE is terminating …

  9. SQL Server tells me database is in use but it isn't

    Feb 24, 2011 · SQL Server keeps telling me a database is in use when I try to drop it or restore it, but when I run this metadata query: select * from sys.sysprocesses where dbid in (select database_id …

  10. sql server - Use Go After 'Use [Database_Name]? - Stack Overflow

    Oct 24, 2017 · USE Name_Of_My_Database GO As far as I can tell, there is no point to this, is there? I have tried looking for the answer in the places listed below, and it's absent: What is the use of GO in …