Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
Blessed1978
Yak Posting Veteran
97 Posts |
Posted - 2014-08-06 : 11:59:03
|
I have a table that has 60 columns. 80% of those rows has quotes included example "407412547" ,"otfde". and they are in different columns. I would like to remove the quotes so that it looks like 407412547,otfde. i can remove the quotes from each column with a simple update statement but instead of doing my updates for each individual column i would like to do it for my entire table. PLEASE ASIST |
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2014-08-06 : 12:29:21
|
You can use the INFORMATION_SCHEMA.COLUMNS view to build a dynamic string that you can then execute. Here's an example:select 'update ' + table_name + ' set ' + column_name + ' = replace(' + column_name + ', ''"'', '''')'from INFORMATION_SCHEMA.COLUMNSTara KizerSQL Server MVP since 2007http://weblogs.sqlteam.com/tarad/ |
|
|
|
|
|