SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Crystal Formula to SQL
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Jysafe
Starting Member

6 Posts

Posted - 11/16/2013 :  09:52:23  Show Profile  Reply with Quote
Hi,

I have been trying to convert the Crystal formula below into T-SQL, but I'm not able to do that. Anyone has any idea on how to convert this?

replace(space(3-len({Cono})), ' ', '1') + {Cono} +
(if len(cstr({empno}, 0, '')) < 4 then
    replace(space(4-len(cstr({empno}, 0, ''))), ' ', '0')
) +
cstr({empno}, 0, '')


Thanks!

SwePeso
Patron Saint of Lost Yaks

Sweden
30106 Posts

Posted - 11/16/2013 :  13:26:17  Show Profile  Visit SwePeso's Homepage  Reply with Quote
SELECT RIGHT('111' + CAST(Cono AS VARCHAR(3)), 3) + RIGHT('0000' + CAST(EmpNo AS VARCHAR(4)), 4)



Microsoft SQL Server MVP, MCT, MCSE, MCSA, MCP, MCITP, MCTS, MCDBA
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.03 seconds. Powered By: Snitz Forums 2000