Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 sql combine field one with case field...

Author  Topic 

duhaas
Constraint Violating Yak Guru

310 Posts

Posted - 2009-11-24 : 16:37:50
Trying to combine the two fields below:

select CLIENT_CODE,
Rtrim(TICKER) as TICKER,
case TICKER
when 'USD'
then 'Cash'
else 'US'
end as Currency
,
OPEN_POSITION
from IMCMFTP..POS
where CLIENT_CODE in ('993006006','993007004','993008002','993009000',
'993013002')

Keep getting Incorrect syntax near '+' when i add the + in between the two

vijayisonly
Master Smack Fu Yak Hacker

1836 Posts

Posted - 2009-11-24 : 16:55:22
Remove "AS TICKER" from the first one and concatenate...

But as madhivanan would say...you need to these kind of formatting changes in the front end.

select CLIENT_CODE,
Rtrim(TICKER) +
case TICKER
when 'USD'
then 'Cash'
else 'US'
end as Currency,
OPEN_POSITION
from IMCMFTP..POS
where CLIENT_CODE in ('993006006','993007004','993008002','993009000',
'993013002')


quote:
Originally posted by duhaas

Trying to combine the two fields below:

select CLIENT_CODE,
Rtrim(TICKER) as TICKER,
case TICKER
when 'USD'
then 'Cash'
else 'US'
end as Currency
,
OPEN_POSITION
from IMCMFTP..POS
where CLIENT_CODE in ('993006006','993007004','993008002','993009000',
'993013002')

Keep getting Incorrect syntax near '+' when i add the + in between the two

Go to Top of Page

duhaas
Constraint Violating Yak Guru

310 Posts

Posted - 2009-11-24 : 16:58:11
thanks much my friend
Go to Top of Page
   

- Advertisement -