By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,377 Members | 1,278 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,377 IT Pros & Developers. It's quick & easy.

Simple Concatenation Question

P: n/a
Here's what I have:

SELECT (Term + CRN) AS Comb
FROM dbo.SAS

Both Term and CRN are Int fields.

When it concatenates it is adding the values together.

For example:

Term CRN Comb
5 18 23
6 11 17
What I want is:

Term CRN Comb
5 18 518
6 11 611
How can this be done?

Thanks
Apr 2 '08 #1
Share this Question
Share on Google+
2 Replies


P: n/a
SELECT CAST(Term AS VARCHAR(10)) + CAST(CRN AS VARCHAR(10)) AS Comb
FROM dbo.SAS
Apr 2 '08 #2

P: n/a
If the values for the CRN column do not exceed 100, then you can do:

SELECT Term * 100 + CRN AS Comb
FROM dbo.SAS

Otherwise Mark's suggestion to concatenate as strings will work.

HTH,

Plamen Ratchev
http://www.SQLStudio.com
Apr 2 '08 #3

This discussion thread is closed

Replies have been disabled for this discussion.