
30/12/2009, 11:41
|
 | | | Fecha de Ingreso: febrero-2007
Mensajes: 289
Antigüedad: 18 años Puntos: 15 | |
Algo asi.. con un cursor... declare @lugar int,@id int
declare cambiar_formato_ok cursor for select PATINDEX( '%,%', nombre),id
from mi_tabla
order by id
open cambiar_formato_ok
fetch next from cambiar_formato_ok
into @lugar ,@id
while @@fetch_status=0
begin
update mi_tabla set nombre=substring(nombre,@lugar+1,len(rtrim(nombre) ))+','+ substring(nombre,1,@lugar-1)) where id=@id
fetch next from cambiar_formato_ok
into @lugar ,@id
end
close cambiar_formato_ok
deallocate cambiar_formato_ok
go
Saludos. |