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.
| Author |
Topic |
|
blamey4
Starting Member
1 Post |
Posted - 2010-01-25 : 18:57:00
|
| Any help would be great!!!SQL Server 2008 What table currently looks like Corp Acct Cust15515 123456 1015515 12345 415515 1234 115515 12 10Corp Column should always be 5 characters Acct Column should always be 6 charcters Cust Column should always be 2 charcters What I need it to look like after Concatenation Concatenation 1551512345610 1551501234504 1551500123401 1551500001210 |
|
|
sodeep
Master Smack Fu Yak Hacker
7174 Posts |
Posted - 2010-01-25 : 20:10:36
|
| Try with Case... With Len Function. |
 |
|
|
chriztoph
Posting Yak Master
184 Posts |
Posted - 2010-01-25 : 21:08:20
|
| try this one;select RIGHT('00000' + CAST(1 AS varchar(5)) ,5) |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-01-25 : 23:53:43
|
| [code]select right('00000'+ cast(Corp as varchar(5)),5) + right('000000'+ cast(Acct as varchar(6)),6) + right('00'+ cast(Cust as varchar(2)),2) from table [/code] |
 |
|
|
|
|
|