Find all tables containing column with specified name

Search Tables: SELECT c.name AS ‘ColumnName’ ,(SCHEMA_NAME(t.schema_id) + ‘.’ + t.name) AS ‘TableName’ FROM sys.columns c JOIN sys.tables t ON c.object_id = t.object_id WHERE c.name LIKE ‘%MyName%’ ORDER BY TableName ,ColumnName; Search Tables and Views: SELECT COLUMN_NAME AS ‘ColumnName’ ,TABLE_NAME AS ‘TableName’ FROM INFORMATION_SCHEMA.COLUMNS WHERE COLUMN_NAME LIKE ‘%MyName%’ ORDER BY TableName ,ColumnName;

How to add a column with a default value to an existing table in SQL Server?

Syntax: ALTER TABLE {TABLENAME} ADD {COLUMNNAME} {TYPE} {NULL|NOT NULL} CONSTRAINT {CONSTRAINT_NAME} DEFAULT {DEFAULT_VALUE} WITH VALUES Example: ALTER TABLE SomeTable ADD SomeCol Bit NULL –Or NOT NULL. CONSTRAINT D_SomeTable_SomeCol –When Omitted a Default-Constraint Name is autogenerated. DEFAULT (0)–Optional Default-Constraint. WITH VALUES –Add if Column is Nullable and you want the Default Value for Existing Records. Notes: … Read more

Is it possible to run multiple DDL statements inside a transaction (within SQL Server)?

I know most databases have restrictions, but Postgres doesn’t. You can run any number table creations, column changes and index changes in a transaction, and the changes aren’t visible to other users unit COMMIT succeeds. That’s how databases should be! 🙂 As for SQL Server you can run DDL inside of a transaction, but SQL … Read more

Connection problems with SQL Server in ASP.NET applications using out-of-process session state

Transport level errors are often linked to the connection to sql server being broken … usually network. Timeout Expired is usually thrown when a sql query takes too long to run. So I would troubleshoot the link to your Sql Server and then monitor to see what queries are timing out. Sounds like a SQL … Read more

How to write a .Net application that works with both SqlServer and Oracle (now that System.Data.OracleClient is deprecated)

EDIT: The fully managed ODP.NET is now available in production. It is very small (less than 10MB) and is not dependent on other files. You can obtain it here: http://www.oracle.com/technetwork/topics/dotnet/downloads/index.html Original answer: One way to easily ensure that the required Oracle client side software (including ODP.NET) is always available on the deployment machine is to … Read more