Main | .NET and FireFox & Netscape »

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?

Error Message:

The text, ntext, and image data types are invalid for local variables.

Testing Code:

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)
print 'yes'
else
print 'no