I'm not completely sure what you're trying to do, but perhaps something like this?
set language spanish
go
update dbo.MyTable
set
prt_Lun = case when datename(dw, prt_fecha) = 'Lunes' then 0x1 else 0x0 end,
prt_Mar = case when datename(dw, prt_fecha) = 'Martes' then 0x1 else 0x0 end,
prt_Mie = case when datename(dw, prt_fecha) = 'Miércoles' then 0x1 else 0x0 end,
prt_Jue = case when datename(dw, prt_fecha) = 'Jueves' then 0x1 else 0x0 end,
prt_Vie = case when datename(dw, prt_fecha) = 'Viernes' then 0x1 else 0x0 end,
prt_Sab = case when datename(dw, prt_fecha) = 'Sábado' then 0x1 else 0x0 end,
prt_Dom = case when datename(dw, prt_fecha) = 'Domingo' then 0x1 else 0x0 end
where
...
If your logic is really this simple then you don't need the prt_%
columns at all, because you can always derive the bit values from prt_fecha
on demand. But I'm guessing that you're setting defaults here that you may override later, in which case the table would make sense.
And when working with dates be careful with culture-specific settings such as SET DATEFIRST
and SET LANGUAGE
.