cancel
Showing results for 
Search instead for 
Did you mean: 

Error while executing SP

Former Member
0 Kudos

Hi All,

I am gettin an error The data types ntext and ntext are incompatible in the equal to operator whil eexecuting the following SP;

if @object_type = '191' and @transaction_type in ('A','U') 
BEGIN 
if exists
 (Select oscl.callid from oscl
  where oscl.U_SERIALNUM=
  (select p.U_SERIALNUM from oscl p
   where p.callid=@list_of_cols_val_tab_del)
  and oscl.callid!=@list_of_cols_val_tab_del)
begin
set @error =2
set @error_message = 'Duplicate Serial Number !' 
end
END

Thanks,

Joseph

Accepted Solutions (1)

Accepted Solutions (1)

former_member206488
Active Contributor
0 Kudos

Hi,

You can't use text columns in an equal operation of a WHERE clause,you have to change your column type from text to either varchar(max) or nvarchar(max) '

Use below code:


if @object_type = '191' and @transaction_type in ('A','U') 
BEGIN 
if exists
 (Select oscl.callid from oscl
  where cast(oscl.U_SERIALNUM as nvarchar(MAX)) =
  (select CAST(p.U_SERIALNUM AS Nvarchar(MAX)) from oscl p
   where p.callid=@list_of_cols_val_tab_del)
  and oscl.callid!=@list_of_cols_val_tab_del)
begin
set @error =2
set @error_message = 'Duplicate Serial Number !' 
end
END

Thanks,

Neetu

Former Member
0 Kudos

Perfect.

Thanks Neetu.

Regards,

Joseph

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Joseph......

I guess the problem is with Datatype of UDF taken in Sevice call......

Change its Datatype or convert it in SP to nvarchar.....

Regards,

Rahul