views:

43

answers:

1

Need help understanding what I am doing with the syntax here, please help! I not only need to convert from float to decimal but I also need to override the original data being migrated to the same format and data (in this case) where necessary to match the newer data.

,CASE  
   WHEN fInvReqMargin IS NOT NULL THEN  
     (CONVERT(DECIMAL(7, 7), fInvReqMargin)(REPLACE(fInvReqMargin, fInvReqMargin, INVESTOR_REQUIRED_MARGIN_FC)))
   ELSE NULL 
 END as INVESTOR_REQUIRED_MARGIN_FC

error: Msg 156, Level 15, State 1, Line 1 Incorrect syntax near the keyword 'CASE'.

Thank you!

A: 

The problem is with the CONVERT and REPLACE syntax. Without seeing the data I can't determine if you're trying to supply the style parameter to CONVERT. If you are then the syntax should be

CONVERT( DECIMAL ( 7,7 ), fInvReqMargin,(REPLACE(fInvReqMargin, fInvReqMargin, INVESTOR_REQUIRED_MARGIN_FC))) 
Dave Barker