t-sql check server name and database name code example Example: server name sql server SELECT @@SERVERNAME AS 'Server Name'