| 
	
 | 
 Posted by JackpipE on 02/23/07 00:01 
> There is no way to loop through the columns in a table in a simple 
> fashion. This is because that it would rarely make any sense; columns 
> in a table are supposed to described distinct attribuets. 
> 
> For a thing like this I would do: 
> 
>    SELECT 'UPDATE PROFILE SET ' + name + ' replace(substring( ' + 
>           name + ', 1, 255), char(13) + char(10), '':'')' 
>    FROM   syscolumns 
>    WHERE  id = object_id('PROFILE') 
>      and  type_name(xtype) like '%char' 
> 
> and the copy, paste and run result. 
 
 
Well that simplify my job but still does not automate the process to a 
point where one query execution will take care of entire table. 
 
Thanks.
 
  
Navigation:
[Reply to this message] 
 |