Renaming SQL Server

Home > Blogs > SQL Server > Renaming SQL Server

Renaming SQL Server

Like This Blog 0 Jeff Jones
Added by December 1, 2006

The following is a T-SQL script you can use to rename your SQL Server after you have changed the computer name. This script will work if you are connected to the default instance or a named instance. After running the script, you must restart SQL Server for the action to complete.

DECLARE @machinename sysname, @servername sysname, @instancename sysname
SELECT @instancename =
CASE
WHEN charindex('\', @@servername) = 0 THEN ''
ELSE SUBSTRING(@@servername,
CHARINDEX('\', @@servername), (len(@@servername)+ 1) –
CHARINDEX('\', @@servername))
END
SET @machinename = convert(nvarchar(100), serverproperty('machinename')) + @instancename;
EXEC sp_dropserver @@servername;
EXEC sp_addserver @machinename, 'local'

Videos You May Like

Cable Testers and How to Use them in Network Environments

0 459 0

This content is from our CompTIA Network + Video Certification Training Course. Start training today! In this video, CompTIA Network + instructor Rick Trader demonstrates how to use cable testers in network environments. Let’s look at some tools that we can use to test our different cables in our environment. Cable Testers Properly Wired Connectivity … Continue reading Cable Testers and How to Use them in Network Environments

Agile Methodology in Project Management

0 172 0

In this video, you will gain an understanding of Agile and Scrum Master Certification terminologies and concepts to help you make better decisions in your Project Management capabilities. Whether you’re a developer looking to obtain an Agile or Scrum Master Certification, or you’re a Project Manager/Product Owner who is attempting to get your product or … Continue reading Agile Methodology in Project Management

Creating Users and Managing Passwords in Microsoft Office 365

0 751 4

In this Office 365 training video, instructor Spike Xavier demonstrates how to create users and manage passwords in Office 365.   For instructor-led Office 365 training classes, see our course schedulle: Spike Xavier SharePoint Instructor – Interface Technical Training Phoenix, AZ 20347: Enabling and Managing Office 365    

Write a Comment

Share your thoughts...

Please fill out the comment form below to post a reply.