How to compare db field of "text" data type?
Given a table with id which is auto number, category, description which is "text". How could I know if the database already have an identical record before I try to insert a new one?
The text, ntext, and image data types are invalid for local variables.
declare @desc text
set @desc = 'description'
declare @cat_id int
set @cat_id = 21
if exists (select pid from position where cat_id = @cat_id and description = @desc)