user1067257
user1067257

Reputation: 453

Check if a table contains a row with a specific column value

In T-SQL syntax, how could I check to see if a table has a row with a a column matching a particular value? I am using SQL Server 2012 and am completely new to it.

Any and all help is greatly appreciated.

Upvotes: 11

Views: 30577

Answers (1)

Brad Christie
Brad Christie

Reputation: 101604

IF EXISTS (SELECT * FROM TABLE WHERE [column] = 'column_value')
  -- The value 'column_value' was found in column [column]

Upvotes: 25

Related Questions