Friday, February 24, 2012

Getting error while using "text" datatype

Hello, I am writing a sproc and am getting this error: Any ideas? Thanks!!

Msg 402, Level 16, State 1, Procedure InsertUserPreferences, Line 18

The data types text and text are incompatible in the equal to operator.

-----------------------------------

create procedure InsertUserPreferences

(

@.PublisherServer text

)

as

begin


if exists(Select Preference_StringList from USER_Preference where Preference_StringList = @.PublisherServer)

begin

--UPDATE

exec dbo.uProc_USER_Preference

end

You cannot use an equal operator with TEXT or NTEXT. You can only use LIKE for comparison. Why are you using text, and not varchar? Are you using SQL 2000 or 2005?|||

Hello and thanks for responding!! I restored data from a SQL Server 2000 database to a SQL Server 2005 to meet our requirements. It was our DBA's decision to make that field a datatype of 'text'.

|||I would recommend changing it to VARCHAR if possible.

No comments:

Post a Comment