I have a table containing around 100 columns, is it to possible to do a Select Replace on every column at the same time rather than typing out each column individually, i'm trying to trim the '"'
of each field in the table.
SELECT
REPLACE(*, '"', '')
4条答案
按热度按时间cyvaqqii1#
qyuhtwio2#
Since you're using SQL Server, you can retrieve the names of all columns on a table using the INFORMATION_SCHEMA, e.g.
You can then use a cursor to iterate over each column name, build some dynamic SQL and execute this using 'exec sp_executesql'.
Here's my solution:
ybzsozfc3#
Here is a recursive version:
pinkon5k4#
another simple way.