database/mssql

0 붙이기

labj 2012. 3. 22. 01:02


select
 'update seatcode set ',
 'name=$'+a.chgnm+'$, ',
 'sname=$'+a.chgnm+'$, ',
 'en_name=$'+a.chgnm+'$, ',
 'seatviewname=$'+a.chgnm+'$ ',
 'where seatno='+convert(varchar,a.seatno)+';'
from
(
select
 case
  when len(name)=1 then '00'+name
  when len(name)=2 then '0'+name
  when len(name)=3 then name
  end as chgnm, seatno
from seatcode
) a