July 12, 2010 at 7:10 am
Okay, I know it's a Monday and I have done this before but I can't get the command
Select @@ServerName to return anything. Just gives me "Comand(s) completed successfully.
I have done this before and it has worked I don't know what I am missing.
I would type:
Select @@ServerName
--> Usually I get the SQL instance name in the query results, but just get
Comand(s) completed successfully
July 12, 2010 at 7:16 am
Should work. . .
What happens if you do
PRINT @@ServerName
?
Also, check
SELECT *
FROM MASTER..sysservers
July 12, 2010 at 7:22 am
Same thing, Command(s) completed successfully. Essentially I am writing a procedure to change the SQL name as we use images of systems to deploy to developers and SQL is pre-installed. Machine always gets renamed when deployed. As I said I did this before no problem and it's p_____g me off. Just don't get it.
July 12, 2010 at 7:34 am
I don't want to sound rude, so don't take this the wrong way please 🙂
It sounds like you're parsing the query instead of executing.
Try pressing "F5" to execute, or go to Query heading, then down to Execute.
July 12, 2010 at 7:35 am
Okay, my bad. I was clicking the green check mark instead of 'Execute'. Finally remembered.
Doh!
July 13, 2010 at 6:40 pm
If your SQL server is hosted on a VM, u are likely to get a wrong Server Name using @@ServerName.. Use OBJECTPROPERTY() function instead..
July 13, 2010 at 6:45 pm
As coldcoffee suggested, use of ObjectProperty is a good reliable source too!
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply