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 2008 Forums
 Transact-SQL (2008)
 Case Query

Author  Topic 

Ratz03
Starting Member

27 Posts

Posted - 2014-11-17 : 05:55:46
Hello,

I have a dynamic sql that appends A,B, C etc to number like

case
when xyz = 1 then Version + 'A'
when xyz = 2 then Version + 'B'
when xyz = 3 then Version + 'C'
when xyz = 4 then Version + 'D' and so on
till Z
end AS Version_Final

Please help me in using a function that can do it rather than writing a case 26 times. Many Thanks

Kristen
Test

22859 Posts

Posted - 2014-11-17 : 07:19:45
[code]SELECT Version + CHAR(64 + xyz) AS Version_Final[/code]
Go to Top of Page

Ratz03
Starting Member

27 Posts

Posted - 2014-11-17 : 07:41:55
Thanks Kristen, worked perfectly.
Go to Top of Page
   

- Advertisement -