April 21, 2005 at 7:39 am
I need to search all the varchat columns of our tables.
If one of these columns has the value 'ABC' in it, then I need to change that content to 'abc'.
I'm not a DBA person. I'm am application developer. Can anyone get me started on this?
April 21, 2005 at 7:57 am
Well, the work (and script) amount depends on your columns number. If you had a lot of them then I suggest you to write cursor which brings you table and column names by one value (@table_name, @column_name) from the table wich holds all columns with the varchar data type( you must create it). In the midle of the cursor you can write a little script to search the value you are interested in and if you find it begin to update that column value.
Simple schema could be like this:
The begin of the cursor
(Gives you first value)
searching column values
on success begin update
(brings next value and goes to searching step)
The end of the cursor
Maybe I didn't mention about some details, but something like that
Hope this helps
April 22, 2005 at 1:42 pm
OK, one quick question before I post some code for you:
Is your SQL install a case sensitive instance?
If not, why would you need to update all that data? Just modify the data in the presentation layer if absolutely necessary. If you have a case sensitive instance, let me know, I 'll post the code.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply