April 1, 2010 at 5:57 am
I have a server with te name "Laptop".
When I retrieve it's name with:
SELECT @@SERVERNAME
-or-
SELECT SERVERPROPERTY('SERVERNAME')
The result is 'LAPTOP' in uppercase. My server is running in case sensitive mode, so this sometimes gives problems.
I have created a linked server to the server "Report01". When i want to sent a query (which is build dynamically with @@SERVERNAME) to this server, I receive an error, because linked server REPORT01 can not be found.
Is their a command which retrieves the name as is.
Regards,
Marco
April 1, 2010 at 6:08 am
You could try with
select serverproperty('MachineName')
OR
select serverproperty('ComputerNamePhysicalNetBIOS')
but I can't confirm it works, because all my servers are name uppercase.
Hope this helps
Gianluca
-- Gianluca Sartori
April 1, 2010 at 6:09 am
Just try something like
set @ServerName = lower(@ServerName)
set @ServerName2 = upper(left(@ServerName,1)) + right(@ServerName, (len(@ServerName)-1))
That should then be upper case first letter, lower case, all the other letters
/* ----------------------------- */
Tochter aus Elysium, Wir betreten feuertrunken, Himmlische, dein Heiligtum!
April 1, 2010 at 6:13 am
Gianluca,
select serverproperty('MachineName')
AND
select serverproperty('ComputerNamePhysicalNetBIOS')
Also return uppercase values.
Marco
April 1, 2010 at 6:16 am
Gregory,
your solution only works for servers with a uppercase character at the beginning, but if the name is MyComputer, then it doesn't work. The query is build dynamically with @@SERVERNAME, because I want to use it for multiple servers, with al kind off names.
Regards,
Marco
April 1, 2010 at 6:28 am
And what about renaming the linked server uppercase?
If you still need the CamelCase name, add a new one all uppercase.
-- Gianluca Sartori
April 1, 2010 at 9:34 am
mchofman (4/1/2010)
I have created a linked server to the server "Report01". When i want to sent a query (which is build dynamically with @@SERVERNAME) to this server, I receive an error, because linked server REPORT01 can not be found.
Server names are always upper case, this is an OS thing, which might be related to the original standard for NetBIOS names.
Why not just rename the linked server to REPORT01?
April 1, 2010 at 9:49 am
Paul,
your completely right. I registered the server in SSMS as Report01, that's why I thought it's name was not UPPERCASE and that's why I also created the linked server as Report01 instead of REPORT01.
I've been working on this NOT existing problem for hours...
Can anybody please erase this topic :blush:
Thanks Paul,
Marco
April 1, 2010 at 9:59 am
mchofman (4/1/2010)
Paul,your completely right. I registered the server in SSMS as Report01, that's why I thought it's name was not UPPERCASE and that's why I also created the linked server as Report01 instead of REPORT01.
I've been working on this NOT existing problem for hours...
Can anybody please erase this topic :blush:
Thanks Paul,
Marco
Comedy Gold!!!
Well done for fronting up to it. Man, that's funny.
Have a great day.
April 1, 2010 at 10:05 am
At this point I wonder why case-sensitive servers allow creating linked servers with non-uppercase names.
It would be a great time saver if only uppercase names were allowed.
-- Gianluca Sartori
April 2, 2010 at 3:03 pm
Gianluca Sartori (4/1/2010)
At this point I wonder why case-sensitive servers allow creating linked servers with non-uppercase names.It would be a great time saver if only uppercase names were allowed.
Not all linked servers link to SQL Server 😉
Besides, can you imagine the complaints if upper case was enforced?
April 2, 2010 at 3:51 pm
Paul White NZ (4/2/2010)
Gianluca Sartori (4/1/2010)
At this point I wonder why case-sensitive servers allow creating linked servers with non-uppercase names.It would be a great time saver if only uppercase names were allowed.
Not all linked servers link to SQL Server 😉
Besides, can you imagine the complaints if upper case was enforced?
Let the complaining begin.
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
April 7, 2010 at 1:32 am
Paul White NZ (4/2/2010)
Gianluca Sartori (4/1/2010)
At this point I wonder why case-sensitive servers allow creating linked servers with non-uppercase names.It would be a great time saver if only uppercase names were allowed.
Not all linked servers link to SQL Server 😉
Besides, can you imagine the complaints if upper case was enforced?
Both DNS labels and WINS names are treated case-insensitive.
Should I forward complaints to IETF? 😀
-- Gianluca Sartori
April 7, 2010 at 2:15 am
Gianluca Sartori (4/7/2010)
Both DNS labels and WINS names are treated case-insensitive. Should I forward complaints to IETF? 😀
They're a bit more modern than NetBIOS.
And yes - definitely IETF.
Viewing 14 posts - 1 through 13 (of 13 total)
You must be logged in to reply to this topic. Login to reply