SQL Server query combining fields into single field

Posted on 2009-04-30
Last Modified: 2012-05-06
I have recently changed over to SQL Server after using a MS Access database in my ASP pages.  I had a query in which I combined 2 field values into a single value for use in my pages.  When I changed over the SQL Server, however, the query doesn't work.  Below is the query as I wrote it for MS Access.  Is it possible to write this to work in SQL Server 2005?  And if so, what do I need to fix?

Chris Cote
SELECT dbo.tblClass.classID AS ID, [type] & ' ' & [class] AS Expr1 FROM dbo.tblClass ORDER BY [type] & ' ' & [class];

Open in new window

Question by:chrscote
    1 Comment
    LVL 2

    Accepted Solution

    Try changing the & to +
     SELECT dbo.tblClass.classID AS ID, [type] + ' ' + [class] AS Expr1 FROM dbo.tblClass ORDER BY [type] + ' ' + [class]; 

    Open in new window


    Featured Post

    Courses: Start Training Online With Pros, Today

    Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

    Join & Write a Comment

    When writing XML code a very difficult part is when we like to remove all the elements or attributes from the XML that have no data. I would like to share a set of recursive MSSQL stored procedures that I have made to remove those elements from …
    So every once in a while at work I am asked to export data from one table and insert it into another on a different server.  I hate doing this.  There's so many different tables and data types.  Some column data needs quoted and some doesn't.  What …
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    754 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

    24 Experts available now in Live!

    Get 1:1 Help Now