I have a database with four tables that has a number of columns (VARCHAR) that contains one or more spaces. I would like to replace these spaces with NULL.
I can do it if I specify the table and each column
UPDATE LaserData
SET Kant = NULL
WHERE Kant= ''
But is there a way that I can use a list of tables and a list of columns and do this for all without writing a query for each?
Best Answer
That's an odd question, but you could go with something like this:
This will create a temporary table to store all the table names and their respective columns, it will then perform an update (in this case) per every column on every table only when datatype is VARCHAR.