Tag Archives: SQL Server

SQL Server: Finding a table in multiple databases.

Just a quick one – I needed to find which databases held a particular table: EXEC sp_msforeachdb ‘use [?] SELECT ”?” as [datbaseName],SCHEMA_NAME(schema_id) as [schemaName], name as [tableName] FROM sys.tables where name = ”MY_TABLE”’ Just replace MY_TABLE with the name … Continue reading

Posted in Development | Tagged | Leave a comment

SQL Server: Finding a column in multiple databases.

My client has many instances of the same database in various versions. The version I’m developing against is missing a field expected by a c# class, and I can’t find a script to create the column. I came up with the following … Continue reading

Posted in Development, Uncategorized | Tagged | Leave a comment

SQL Server – searching all columns and tables

I’ve inherited a legacy app at work, the developer having gone on to pastures new. The handover was a little light in details especially in the area of the database. Of course, the first bit of work that comes in … Continue reading

Posted in Development | Tagged , | 1 Comment