add text to sql select statement

Posted on 2006-05-23
Last Modified: 2008-02-01
I need help adding text to a select statement

select  '<b>Subtotal:</b>' + (@Query1 - @Query2)

@Query1 and @Query2 are int values in a stored procedure

@Query1 looks something like
      Select @Query1 = Sum(Total)

     from (select distinct Total, type,unitid

             from tbltesting

            where convert(char(8), Date, 112) = @Date -1)as TMP

The error I get is 'Syntax error converting the varchar value to a column int'
Question by:ETKN
    1 Comment
    LVL 5

    Accepted Solution

    select  '<b>Subtotal:</b>' + convert(varchar, (@Query1 - @Query2) )

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    I wrote this interesting script that really help me find jobs or procedures when working in a huge environment. I could I have written it as a Procedure but then I would have to have it on each machine or have a link to a server-related search that …
    Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
    Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
    Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

    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

    11 Experts available now in Live!

    Get 1:1 Help Now