Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 12890

Update query

$
0
0

I would like to update all the columns in my table to remove the speech marks from the fields.

the below script will update on field

UPDATE tbtest
SET [column 1] = REPLACE([column 1], '"', '')

I've written the below script to out all possible updates available from the columns, but I'm stuck on the last bit of the REPLACE script.  any help on this.

SELECT 'UPDATE tbtest SET ' + COLUMN_NAME + ' = REPLACE(' + COLUMN_NAME + ''
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = 'tbtest '
AND IS_NULLABLE = 'YES' AND DATA_TYPE IN ('char', 'nchar', 'varchar', 'nvarchar')


Viewing all articles
Browse latest Browse all 12890

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>