April 29, 2007 at 6:58 pm
I can get the database name from DB_Name() BUT
how can I get the Server name?
Thanks,
Phil
April 29, 2007 at 8:53 pm
Try @@ServerName.
April 30, 2007 at 7:13 am
I will try that. Thanks
BUT
I was able to get it with this as well
DECLARE @DBServer nvarchar(50)
SELECT @DBServer = name FROM sys.servers
Again thanks for your help.
Phil
April 30, 2007 at 8:50 am
Don't be fooled, neither get used to it. Go ahead and create some linked servers, or connect to other instances and so on and run the the same query.
May 1, 2007 at 9:07 am
Camilo is right. That seems to work fine in your situation because you apparently don't have any linked servers.
Generally, you have to add
Where server_id = 0
But in any case select @@servername is more elegant
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply