UPDATE STAGING.STAGING_PREPOUICS
SET column3 = 'EN'
WHERE column4 LIKE '%ENG%';
Like I said, I'm not familiar with Sybase but I know this would work with MySQL.
| [reply] [d/l] |
Shiza
Ok, I will admit, I spoke to soon. I guess I've just been looking at the problem for to long today. YOu were right. Thanks,
Bobby
| [reply] |
I've been there many, many times and sometimes another pair of eyes is all you need. ;) What are fellow monks for?
| [reply] |
UPDATE foo
SET col3 = 'EN'
WHERE LOWER( col4 ) LIKE '%ENG%'
(or LCASE or LC or whatever, depending on the function for your specific database)
lots of options ... personally, I like the Class::DBI one. This is kinda what Class::DBI was created for.
My criteria for good software:
- Does it work?
- Can someone else come in, make a change, and be reasonably certain no bugs were introduced?
| [reply] [d/l] |
I'll all for Class::DBI. Wouldn't the best solution be to add a handler to the class for that table:
__PACKAGE__->set_sql(query_name_here => qq{
UPDATE __TABLE__
SET col3 = ?
WHERE LOWER( col4 ) LIKE CONCAT('%', ?, '%')
};
I'm not sure if the CONCAT function would be necessary. | [reply] [d/l] |
If you're doing the concatenation in SQL, then it's necessary. (Note, CONCAT() is MySQL-specific. Oracle, for example, would use the || operator.)
Yes, it's possible and probably preferable to do it that way. However, I was demonstrating how CDBI makes simple-to-conceive-of tasks simple-to-do. It's the difference between Assembler (DBI) and Perl (CDBI).
My criteria for good software:
- Does it work?
- Can someone else come in, make a change, and be reasonably certain no bugs were introduced?
| [reply] |