Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

SQL Server query combining fields into single field

Posted on 2009-04-30
1
Medium Priority
?
178 Views
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

0
Comment
Question by:chrscote
1 Comment
 
LVL 2

Accepted Solution

by:
_DanElliott earned 2000 total points
ID: 24272895
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

0

Featured Post

Restore individual SQL databases with ease

Veeam Explorer for Microsoft SQL Server delivers an easy-to-use, wizard-driven interface for restoring your databases from a backup. No expert SQL background required. Web interface provides a complete view of all available SQL databases to simplify the recovery of lost database

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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 …
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.
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

810 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