I have to embed my SQL within Flex until I can work out how to call a SQLServer 
proc from within Flex (any pointers here would be much appreciated), and am 
writing functions:

private function sel_mrkt_pln_yrs(p_string:String = null):String{
   var sqlString:String = "select distinct issue_yr, cast(issue_yr as Int) as 
ID from MKT_PLN where (case when " + p_string + " is not null then case when 
mkt_pln_typ = " + p_string + " then 1 end else 1 end) = 1 order by 1 desc;";    
     
                
                return sqlString; 
        }

I would like to format the SQL so I can read it:

        select distinct
                issue_yr,
                cast(issue_yr as Int) as ID
        from
                MKT_PLN
        where
                (case when @p_mkt_pln_typ is not null then
                        case when mkt_pln_typ = @p_mkt_pln_typ then
                                1
                        end
                else
                        1
                end) = 1
        order by
                1 desc;

but var sqlString:String = ... will not take the separate lines etc. How are 
people doing this? TIA,

Mic.




Reply via email to