About 301,000 results
Open links in new tab
  1. sql server 2008 - Changing the name of a SQL database - Stack …

    Jul 19, 2023 · Rename Physical files: Once the database is detached the physical files are unlocked and you can rename them using Windows Explorer: Attaching database with New Name: For it use T SQL: USE [master] CREATE DATABASE [SqlAndMe] ON ( FILENAME = N’C:\…\NewName.mdf’), ( FILENAME = N’C:\…\NewName_log.LDF’) FOR ATTACH

  2. rename database name in sql server management studio 2014

    Jun 20, 2020 · USE [master]; GO --Disconnect all existing session. ALTER DATABASE Datatbase_Name SET SINGLE_USER WITH ROLLBACK IMMEDIATE GO --Change database in to OFFLINE mode. ALTER DATABASE Datatbase_Name SET OFFLINE To rename Physical Database Files, use Open SQL Server Management Studio Folder or use the script below-- To allow advanced options to be ...

  3. sql server - How to modify / rename the database name in SQL?

    How to modify / rename the database name in SQL? Running the below script throws exception as " Incorrect syntax near @dbname " Declare @dbname nvarchar(50) set @dbname = 'MyDatabase_Test' ALTER

  4. How to rename a table in SQL Server? - Stack Overflow

    The SQL query that I have used is : ALTER TABLE oldtable RENAME TO newtable; But, it gives me an error. Server: Msg 156, Level 15, State 1, Line 1 Incorrect syntax ...

  5. sql server - How to rename the Physical Database Files - Stack …

    Open and connect to the SQL server where the database you wanted to rename is located. Execute the following script in the query window in order to change the physical and logical names. Remember to replace all the " OldDatabaseName " with the new name of the database (" NewDatabaseName ") you want to change its name to.

  6. Error on renaming database in SQL Server 2008 R2

    May 22, 2013 · For me the reason why I could not rename a database is because there are active connections. I just take the database offline first, ticking the Drop All Active Connections. Then bring it online again and I can rename the database already.

  7. Rename SQL Server Name - Stack Overflow

    Aug 22, 2015 · Using Management studio In Object Explorer, connect to an instance of the SQL Server Database Engine, and then expand that instance. Make sure that no one is using the database, and then set the database to single-user mode. Expand Databases, right-click the database to rename, and then click Rename. Enter the new database name, and then click OK.

  8. How do I rename a MySQL database (change schema name)?

    How do I quickly rename a MySQL database (change its schema name)? Usually I just dump a database and re-import it with a new name. This is not an option for very big databases. Apparently RENAME {DATABASE | SCHEMA} db_name TO new_db_name; does bad things, exists only in a handful of versions, and is a bad idea overall.

  9. How do I rename a column in a database table using SQL?

    Oct 6, 2008 · This was implemented before the SQL standard addressed the issue - if it is addressed in the SQL standard. My copy of the SQL 9075:2003 standard does not show it as being standard (amongst other things, RENAME is not one of the keywords).

  10. Rename database data file in SQL Server 2005 - Stack Overflow

    May 3, 2010 · Run this in SSMS in text mode to get a T-SQL script and DOS commands that will rename all your .ndf files. It assumes you want your files named the same as your filegroups minus a 'FG_' prefix that I like to use on my filegroups. Cheers. /***** SCRIPT NAME: Rename FileNames 02.sql. PURPOSE: Rename multiple filenames on the database.