Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL language that act the same as "&" in Excel or || in SAS

Status
Not open for further replies.

devon59

Technical User
Nov 30, 2005
18
US
Hi there,
I am trying to create a new variable base on a combination of the characters in an existing value. For example, Var1 has a value "ABCDEFG" and I would like to create a Var2 which should look like "ABC__F".

I tried substring(ltrim(rtrim(Var1,1,3))) to get "ABC" part. However, I don't know how to get "__F" part.

Could someone please help?
Thank you
 
Use the plus sign (+) to concatenate two strings together.

Denny
MCSA (2003) / MCDBA (SQL 2000) / MCTS (SQL 2005) / MCITP Database Administrator (SQL 2005)

--Anything is possible. All it takes is a little research. (Me)
[noevil]
 
The ANSI SQL concatenation operator is ||

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Thank you Denny and PH. Would what you recommendd work in SQL 2005?
 
I think the T-SQL concatenation operator is +

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Yep, it sure is.

Sorry PHV, forgot which forum I was in.

Denny
MCSA (2003) / MCDBA (SQL 2000) / MCTS (SQL 2005) / MCITP Database Administrator (SQL 2005)

--Anything is possible. All it takes is a little research. (Me)
[noevil]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top