|
database
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
PL/SQL to T-SQLI've been pulling my hair out in trying to convert the following two Oracle stmts. to its T-SQL equivalent: :::::::::: SET @sSelect = 'Select 1. sum(decode(tc_trx_code_type,''X'',decode(instr(tc_description,''GST''),0,decode(instr(tc_description,''G.S.T.''),0,round(ft_guest_account_debit,3),0),0),0)) ''PST/PHT'',' 2. @sSelect = @sSelect + 'sum(decode(tc_trx_code_type,''X'',decode(instr(tc_description,''GST''),0,decode(instr(tc_description,''G.S.T.''),0,0,round(ft_guest_account_debit,3)),round(ft_guest_account_debit,3)),0)) ''GST'',' :::::::::: In my humble attempt to convert it, I came up with...SET @sSelect = 'Select CASE WHEN tc_trx_code_type = 'X' THEN CHARINDEX('GST',tc_description,0)' .... but then got lost in its translation. I'm don't know PL\SQL, so I'm hoping some PL\SQL/T-SQL guru can help me out here. Thanks. |
|||||||||||||||||||||||