July 30, 2009 at 4:48 am
Dear All,
One of our client changed machine name after installing SQL Server.I was able to login to SQL server as usual and SQL servername (same as machine name)was displayed in the object explorer as well.I created a DSN and even that was connecting without any problem.
Problem happend when I executed one of my ASP file, which inserts data into a table using the above mentioned DSN. Got error saying "Could not fine "SERVER NAME" in sys.servers.
When I query "Select @@servername" I got someother name (must be the OLD machine name).But in object explorer it was showing differently. Why so.?
How was I able to login with the server name which was not there in "sys.servers".?
Thanks.
July 30, 2009 at 5:08 am
you login using your old server name OR new server name? OR local host (.)
and which mode you using for login SA/windows?
July 30, 2009 at 5:11 am
Hi,
Whenever a system in renamed at the o/s it has to be renamed at the sql server level also. Try following steps. Login into the sql server system and try this.
If it is a default instance
sp_dropserver
GO
sp_addserver , local
GO
If it is a named instance
sp_dropserver
GO
sp_addserver , local
GO
and restart the sql server services and check out
SELECT @@SERVERNAME AS 'Server Name'
[font="Verdana"]Thanks
Chandra Mohan[/font]
July 30, 2009 at 5:27 am
you was able to login because, you must be having alias created using your server IP and old server name.
If you remove that alias then you wont be able to login using your old server name.
check this.
July 30, 2009 at 2:37 pm
@chandu, I'm pretty sure the code will throw an error message.
From BOL syntax for dropserver: sp_dropserver [ @server = ] 'server'
[ , [ @droplogins = ] { 'droplogins' | NULL} ]
It looks like you need to use old server name.
@OP:
select @@servername will show you current server name, copy that and replace 'server' in the following with the output:
sp_dropserver 'old_server'
GO
sp_addserver 'new_server', local
GO
exec sp_helpserver
July 31, 2009 at 4:02 am
Hi Binko,
Thanks for the correction. I had missed the servername in dropserver.
[font="Verdana"]Thanks
Chandra Mohan[/font]
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply