TSQL - Find a column in the database

If you need to find where a certain column is used in the database you can use the following sql code.

select *
from INFORMATION_SCHEMA.columns
where column_name = 'CustomerStatus'

TSQL - Update using an inner join

Sometimes you want to update a table and require a join with another table. The achieve this use the following construction.

UPDATE t1
SET t1.CalculatedColumn = t2.[Calculated Column]
FROM dbo.Table1 AS t1
INNER JOIN dbo.Table2 AS t2 ON t1.CommonField = t2.[Common Field]
WHERE t1.BatchNo = '110';

Sponsored by

Calendar

<<  May 2018  >>
MoTuWeThFrSaSu
30123456
78910111213
14151617181920
21222324252627
28293031123
45678910

View posts in large calendar

RecentComments

TextBox