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. "use database_name" command in PostgreSQL - Stack Overflow

    I am beginner to PostgreSQL. I want to connect to another database from the query editor of Postgres - like the USE command of MySQL or MS SQL Server. I found \\c databasename by searching the In...

  3. 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 …

  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. 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 …

  6. 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 …

  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. 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 ...

  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. How to use a variable for the database name in T-SQL?

    Unfortunately you can't declare database names with a variable in that format. For what you're trying to accomplish, you're going to need to wrap your statements within an EXEC () statement.