Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
phaze
Starting Member
42 Posts |
Posted - 2008-12-05 : 16:14:50
|
| i have the following code:UPDATE loyalty_offer_cntlSET end_date = '2009-01-24 23:59:59.997', audit_id = @audit_id, database_action = 'U'WHERE loyalty_offer_code = 'BC102-EM'or loyalty_offer_code = 'BC103-EM'or loyalty_offer_code = 'BC104-EM'or loyalty_offer_code = 'BC105-EM'now my question is that if i use OR will this update the end_date to my specified date for all three different loyalty_offer_code?I previously had it as this code below but i figured i could simplify my coding. UPDATE loyalty_offer_cntlSET mclu_num = 798149,audit_id = @audit_id,database_action = 'U'WHERE loyalty_offer_code = 'BC102-EM'UPDATE loyalty_offer_cntlSET mclu_num = 798149,audit_id = @audit_id,database_action = 'U'WHERE loyalty_offer_code = 'BC103-EM'UPDATE loyalty_offer_cntlSET mclu_num = 798150,audit_id = @audit_id,database_action = 'U'WHERE loyalty_offer_code = 'BC104-EM'UPDATE loyalty_offer_cntlSET mclu_num = 798150,audit_id = @audit_id,database_action = 'U'WHERE loyalty_offer_code = 'BC105-EM' |
|
|
hanbingl
Aged Yak Warrior
652 Posts |
Posted - 2008-12-05 : 16:52:04
|
| yes, you can also use IN(...) asloyalty_offer_code in ('BC102-EM','BC103-EM'...) |
 |
|
|
phaze
Starting Member
42 Posts |
Posted - 2008-12-05 : 16:57:39
|
| ahh ok...makes sense...i guess i should use IN to make it even more simple for myself. thanks for the input. |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-12-05 : 17:11:15
|
IN?WHERE loyalty_offer_code LIKE 'BC10[2345]-EM' E 12°55'05.63"N 56°04'39.26" |
 |
|
|
|
|
|