Advertisement
Guest User

Untitled

a guest
Oct 31st, 2014
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.75 KB | None | 0 0
  1. select Cont_Cont_Numb, Prim_Ownr_Sname+' '+Prim_Ownr_Gname as name,
  2. case when ISNULL(Othr_Addr_Addr1,'')<>'' then Othr_Addr_Addr1+'' else '' end +
  3. case when ISNULL(Othr_Addr_Addr2,'')<>'' then ', '+Othr_Addr_Addr2+'' else '' end +
  4. case when ISNULL(Othr_Addr_Surb_Town,'')<>'' then ', '+Othr_Addr_Surb_Town+'' else '' end +
  5. case when ISNULL(Othr_Addr_City,'')<>'' then ', '+Othr_Addr_City+'' else '' end +
  6. case when ISNULL(Othr_Addr_State,'')<>'' then ', '+Othr_Addr_State else ''
  7. end as Addr, Population_Desc as country from CuMe_Curr_Cont
  8. join CuMe_Curr_Prim_Ownr on Cont_Mem_Numb=Prim_Ownr_Mem_Numb
  9. join CuMe_Curr_Othr_Addr on Cont_Mem_Numb=Othr_Addr_Mem_Numb
  10. join CuMe_Curr_Population on Othr_Addr_Country=Population_Code
  11. where (isnull(Othr_Addr_Exdate,'')='' or Othr_Addr_Exdate>=GETDATE()) and Cont_Cont_Numb in (
  12. '301/170195/BC067-TR083','305/090395/BC400','48/041299/0555','48/151208/12263','48/160306/7355','48/200207/7451','48/201207/1482','48/210208/1489','48/261108/30173','48/290110/1524','48/290110/1524','15/070196/1024-TR013','15/200196/2033-TR610','33/050597/0856','48/030305/1424','48/200300/9403','48/200300/9403','48/201207/1482','48/201207/1482','48/201207/1482','48/201209/12432','48/241206/1458','48/241206/1458','48/280107/7429','48/280107/7430','67/080607/4010'
  13. )order by charindex(','+cast(Cont_Cont_Numb as varchar(max))+',', ',301/170195/BC067-TR083,305/090395/BC400,48/041299/0555,48/151208/12263,48/160306/7355,48/200207/7451,48/201207/1482,48/210208/1489,48/261108/30173,48/290110/1524,48/290110/1524,15/070196/1024-TR013,15/200196/2033-TR610,33/050597/0856,48/030305/1424,48/200300/9403,48/200300/9403,48/201207/1482,48/201207/1482,48/201207/1482,48/201209/12432,48/241206/1458,48/241206/1458,48/280107/7429,48/280107/7430,67/080607/4010,')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement