Link to home
Start Free TrialLog in
Avatar of leezac
leezac

asked on

Combine two columns

How do I combine to columns.  I am trying this way but get an error "invalid number".  Both columns are Characters (text and numbers)

SELECT DVSN_NM ,Fund_C + '' + Fund_Shrt_NM) as Fund_Name
FROM
dbo.V_BAL_MO  BALMO
    --
Avatar of Gary
Gary
Flag of Ireland image

CONCAT(Fund_C, '', Fund_Shrt_NM)
Avatar of slightwv (䄆 Netminder)
slightwv (䄆 Netminder)

Also:
Fund_C || Fund_Shrt_NM

An empty string in Oracle is a NULL value so it does nothing to have it.
I presumed they were trying to add a space or something between them - maybe not...
just use "||" instead of "+"

Fund_C + '' + Fund_Shrt_NM
>>>
Fund_C || '' || Fund_Shrt_NM
Incorrect concatenation character and the extra right-parenthesis before as Fund_Name needs to be removed:
SELECT	DVSN_NM
,	Fund_C || ' ' || Fund_Shrt_NM as Fund_Name
FROM	V_BAL_MO

Open in new window

Avatar of leezac

ASKER

Well actually a hyphen ABCD-Trust Dept.  Slightwv worked - no space or hyphen
I would guess that as well but what is posted will not do that.  You would need to physically add the space in it:

Fund_C || ' ' || Fund_Shrt_NM

I missed this when I posted:  Your CONCAT syntax is invalid.  CONCAT takes two parameters only.  Anything more will result in an error.

You use concat with 3 parameters you need to nested concat calls:
CONCAT(Fund_C, CONCAT(' ', Fund_Shrt_NM))
ASKER CERTIFIED SOLUTION
Avatar of slightwv (䄆 Netminder)
slightwv (䄆 Netminder)

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of leezac

ASKER

My previous browser was not allowing me to award points.  Thanks for help