change my server name with following commands but this worked half way only

  • I tried to change my server name with following commands but this worked half way only.

    sp_dropserver 'Lucky-PC\SQLEXPRESS'

    sp_addserver 'SQLEXPRESS'

    select * from sys.servers -- This gives me the server name as SQLEXPRESS

    select @@servername -- I get this value as NULL

  • you should use: sp_addserver 'SQLEXPRESS', 'local'

    (drop the first one you added .. without the 'local')

    then bounce the service and see what happens.

    The probability of survival is inversely proportional to the angle of arrival.

  • It worked, Sturner. Thanks.

    So the logic is that we need to use 'local' when we want the @@servername not to return the NULL value.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply