Skip to Content
author's profile photo Former Member
Former Member

Error while executing SP

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

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    Posted on Oct 29, 2010 at 01:13 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 29, 2010 at 01:17 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.