Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help needed on @@SERVERNAME in SQLServer

Status
Not open for further replies.

RamHardikar

Programmer
Joined
Feb 16, 2001
Messages
109
Location
GB
Hi,

we are trying to replicate our existing database onto the backup server.
when i run the wizard to create publication it says " @@SERVERNAME is NULL . Use sp_addserver to add the server".

we have tried the following option -

started SQL server in minimal configuration using 'sqlservr -f' and tried to execute sp_addserver and then restarted the sqlserver. now we executed 'select @@servername', the result was null. i also tried to execute sp_dropserver before doing the above operation. but still same result.
Pls help

Thanks in advance
Ram
 

Did you use the 'Local' option when executing sp_addserver?

--Drop server from list
sp_dropserver 'ServerName'
go

--Add Server as 'LOCAL'
sp_addserver 'ServerName','LOCAL'
Go

--View info about server
exec sp_helpserver
go Terry L. Broadbent
FAQ183-874 contains tips for posting questions in these forums.
NOTE: Reference to the FAQ is not directed at any individual.
 
I would tell you to first "exec sp_helpserver go"
If the server you are looking for has an "id" other than "0"
then could do
--Drop server from list
sp_dropserver 'ServerName'
go

--Add Server as 'LOCAL'
sp_addserver 'ServerName','LOCAL'
Go

** Now you must restart SQL Server

--View info about server
exec sp_helpserver
go

But if does not exists then you can

--Add Server as 'LOCAL'
sp_addserver 'ServerName','LOCAL'
Go

** Now you must restart SQL Server

--View info about server
exec sp_helpserver
go
AL Almeida
NT/DB Admin
"May all those that come behind us, find us faithfull"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top