You are here: Re: How to run replace on all columns « MsSQL Server « IT news, forums, messages
Re: How to run replace on all columns

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация