Profile

Thursday, 23 May 2013

Find Server Name, Database name from Tables

When querying data from multiple database across multiple server, a simple two lines of SQL code can tell where the data comes from 

SELECT
@@servername,
DB_NAME() as 'Database name'

FROM dbo.tablename