In this post i would like to give you a simple tip on how to get the Server Name of the SQL server.
In order to get the SQL Server - Server name you need to use Global Variable as shown below.
SELECT @@SERVERNAME AS Server_Name
Friday, January 15, 2010
Getting the Server Name in SQL Server using @@SERVERNAME
Labels:
DotNetVJ,
SQL Server,
Vijaya Kadiyala
Subscribe to:
Post Comments (Atom)
1 comment:
Hi vijay,
Just wanted to add something to your post. If servername is changed then @@servername still points to the oldname. Updated name can be found by Serverproperty('Servername').
Updated servername will reflect on sql server after one does sp_dropserver and then continue with sp_addserver 'newname','local' and then perform a service restart.
You may be aware of these. Just wanted to add to ur post. :)
Regards,
Raj
Post a Comment