I have an app that run on many computers and connect to sql server I want to log the machine names of that computers in a table every time they connect how can I do that
I want to know if there is a command like that
"Select @@MachineName"
I have an app that run on many computers and connect to sql server I want to log the machine names of that computers in a table every time they connect how can I do that
I want to know if there is a command like that
"Select @@MachineName"
Create linked server : (allowing access to distributed, heterogeneous queries against OLE DB data sources.) using following command :
sp_addlinkedserver [ @server= ] 'server' [ , [ @srvproduct= ] 'product_name' ] [ , [ @provider= ] 'provider_name' ]
[ , [ @datasrc= ] 'data_source' ] [ , [ @location= ] 'location' ] [ , [ @provstr= ] 'provider_string' ] [ , [ @catalog= ] 'catalog' ]
Then access is like :
Select * from [server-name].[db-name].dbo.[tablename]
Also, make sure security login you are using on both the servers is same (or atleast exists on other server too).
It's up to you how you want to log this information, but HOST_NAME() returns the name of the workstation connecting to the server.