SQL编程例1

select
sno, l.file_content, l.desc_file_name, l.desc_file_name_link, l.modelname_file_name,

l.modelname_file_name_link, l.model_name, l.station, l.factory, l.version, convert(decimal

(5,2),  version) as version_2 , '/e-cad/src/com/OpenFile.aspx?

Path=pathdefModelcode&FileName=' + desc_file_name_link  as desc_url, 'download' as

modelname_name, '/e-cad/src/com/Download.aspx?Path=pathdefModelcode&FileName=' +

modelname_file_name_link  as modelname_url,

 convert ( varchar,  case  when u_date is null then c_date  else u_date  end , 120 )  as

upload_date ,


case  when u_user is null then e1.emp_cname  else e2.emp_cname end as uploader , (case      

  when isNull(l.a_formno, '') <> '' then l.a_formno        else ( case               when

isNull(l.rd_formno, '') <> '' then l.rd_formno               when isNull(l.it_formno, '') <>

'' then l.it_formno               else null               end )   end) as apply_formno ,

l.a_formno  , (case         when isNull(l.a_formno, '') <> '' then ''        else ( case    

           when isNull(l.rd_formno, '') <> '' then '' + convert(varchar, l.rd_formno)       

        when isNull(l.it_formno, '') <> '' then '/e-cad/src/com/flower_view_router.aspx?

form_kind=AUO.FORM.105&form_no=' + convert(varchar, l.it_formno)                else null   

           end )   end) as apply_formno_url , l.d_formno , '' as d_formno_url , (case       

             when isNull(l.rd_formno, '') <> '' then convert(varchar, l.rd_formno)          

         when isNull(l.it_formno, '') <> '' then convert(varchar, l.it_formno)              

     else ''    end) as it_formno 


from d_doc_modelcode l, d_authempl e1, d_authempl e2 

 

where l.c_user *= e1.emp_id and l.u_user *= e2.emp_id and l.active = 'Y' and (  [model_name]

like '%H179IT01 V1%'  or [model_name] like '%General%' ) and (  [station] like '%FD%'  or

[station] like '%General%' )

posted @ 2008-11-14 07:54  只想做好  阅读(116)  评论(0)    收藏  举报