Converting data types in sql procedure

Posted on 2012-08-14
Last Modified: 2012-08-14
I have a procedure that receives a variable @comments datatype Text.  The procedure is adding a new workorder and uses @comments to fill a field.  My problem is I need to add this to the @comment variable before it appends to the data table.  'Time In:' + CHAR(13) + 'Time Out:' + CHAR(13) + 'Tech:' +  CHAR(13) + 'Date:'  

I keep getting an error saying the operand "+" can not be used with comment.  I have no access to code behind but I do have access to the data and stored procedure the program uses, thats why I need to get it done in the stored procedure.

Question by:mgmhicks
    LVL 10

    Accepted Solution

    Update Table Set Comments = Convert(varchar(max),Comments) +  'Time In:' + CHAR(13) + 'Time Out:' + CHAR(13) + 'Tech:' +  CHAR(13) + 'Date:'

    Author Closing Comment

    Perfect thanks!

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Is Threat Intelligence?

    Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

    In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
    In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
    This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
    Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    8 Experts available now in Live!

    Get 1:1 Help Now