0
SELECT
         SLTR_COMP_CODE,
         sltr_ldgr_code,
         sltr_slmast_acno Acno,
         SUBSTRING(sltr_slmast_acno, 1, 1) category,
         ISNULL(SUM(CONVERT(FLOAT, sltr_tran_amt - ISNULL(sltr_matched_amt, 0))), 0) Net_Bal,
         SUM(CONVERT(FLOAT, CASE DBO.glas_agewise_analysis(CONVERT(DATETIME, '2009-04-04', 103) - FLOOR(sltr_pstng_datetime)) 
            WHEN 1 THEN (sltr_tran_amt - ISNULL(sltr_matched_amt, 0)) 
            ELSE 0 
        END)) thirty_days,
         SUM(CONVERT(FLOAT, CASE DBO.glas_agewise_analysis(CONVERT(DATETIME, '2009-04-04', 103) - FLOOR(sltr_pstng_datetime)) 
            WHEN 2 THEN (sltr_tran_amt - ISNULL(sltr_matched_amt, 0)) 
            ELSE 0 
        END)) sixty,
         SUM(CONVERT(FLOAT, CASE DBO.glas_agewise_analysis(CONVERT(DATETIME, '2009-04-04', 103) - FLOOR(sltr_pstng_datetime)) 
            WHEN 3 THEN (sltr_tran_amt - ISNULL(sltr_matched_amt, 0)) 
            ELSE 0 
        END)) ninty,
         SUM(CONVERT(FLOAT, CASE DBO.glas_agewise_analysis(CONVERT(DATETIME, '2009-04-04', 103) - FLOOR(sltr_pstng_datetime)) 
            WHEN 4 THEN (sltr_tran_amt - ISNULL(sltr_matched_amt, 0)) 
            ELSE 0 
        END)) One_twenty,
         SUM(CONVERT(FLOAT, CASE DBO.glas_agewise_analysis(CONVERT(DATETIME, '2009-04-04', 103) - FLOOR(sltr_pstng_datetime)) 
            WHEN 5 THEN (sltr_tran_amt - ISNULL(sltr_matched_amt, 0)) 
            ELSE 0 
        END)) One_fifty
FROM  glas_sl_transactions 
WHERE    SLTR_COMP_CODE  = '1'
 AND    sltr_ldgr_code  = '01'
GROUP BY sltr_ldgr_code,
     sltr_slmast_acno,
      SLTR_COMP_CODE 

error: Msg 260, Level 16, State 3, Line 1 Disallowed implicit conversion from data type datetime to data type float, table 'glas_sl_transactions', column 'SLTR_PSTNG_DATETIME'. Use the CONVERT function to run this query.

how can i run this query?

1
  • given that you've been a member for 4 months, I would have thought you would know how to at least format the code? Commented Jan 6, 2010 at 8:52

1 Answer 1

2

Try replacing your expressions with:

CONVERT(float, CONVERT(datetime, '2009-04-04', 103))
    - FLOOR(CONVERT(float, sltr_pstng_datetime))

so that all your conversions are explicit.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.