Hi,

In a simple select query where the datatypes are the same you can use this:

SELECT (au_lname + ', ' + au_fname) AS Name
FROM authors
ORDER BY au_lname ASC, au_fname ASC


If the datatypes are different you need to use cast:

SELECT 'The order date is ' + CAST(ord_date AS varchar(30)) as display_date
FROM sales
WHERE ord_num = 'A2976'
ORDER BY ord_num


You can also use Convert() instead of Cast()

Hope it helps,
Mario




-----Original Message-----
From: Cantrell, Adam [mailto:[EMAIL PROTECTED]
Sent: 04 June 2003 18:14
To: CF-Talk
Subject: SQL concat


What's the operator for string concatenation in SQL server - I'm trying:

SET txtColumnName1 = txtColumnName1 + '#form.txtFormField1#'

And that's throwing me an "Invalid operator for data type" error.

Anyone help me out right quick? Adam.


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq

Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. 
http://www.fusionauthority.com/ads.cfm

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
                                

Reply via email to