Friday, 3 May 2013

How to Get Instance Name from T-SQL (get server Name, and more details)

How to Get Instance Name from T-SQL (get server Name, and more details)

1. Select Case 
        When SERVERPROPERTY ('InstanceName') Is Null Then @@SERVERNAME
        Else SERVERPROPERTY ('InstanceName')
        End   (or)
  select convert(nvarchar(128), serverproperty('servername'));
    2. sp_helpserver
    3. select @@servername
    4. select * from SYS.SYSSERVERS
    5. select * FROM SYS.SERVERS


***(server_id,name,product,provider,data_source,location,provider_string,catalog,connect_timeout,query_timeout,is_linked,is_remote_login_enabled,is_rpc_out_enabled,is_data_access_enabled,is_collation_compatible,uses_remote_collation,collation_name,lazy_schema_validation,is_system,is_publisher,is_subscriber,is_distributor,is_nonsql_subscriber,is_remote_proc_transaction_promotion_enabled,modify_date)

No comments:

Post a Comment