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 |
|
Job
Yak Posting Veteran
69 Posts |
Posted - 2005-08-12 : 08:35:43
|
| Set Fxd_Units =CASE WHEN TxnUnitsBase = Null THEN Fxd_Units = left(TxnUnitsDur,len(TxnUnitsDur)-1)/15 WHEN (TxnUnitsBase <> Null and TxnUnits like '%,%' and TxnUnits not like '%M%') THEN Fxd_Units = TxnUnitsBase WHEN TxnUnitsBase <> Null THEN Fxd_Units = left(TxnUnitsDur,len(TxnUnitsDur)-1)/15 + TxnUnitsBaseENDWhere TxnUnits like '%M%' or TxnUnits like '%,%'Any help is appreciated.Cheers,Job |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2005-08-12 : 08:45:19
|
you are missing the FROM part.Go with the flow & have fun! Else fight the flow |
 |
|
|
Job
Yak Posting Veteran
69 Posts |
Posted - 2005-08-12 : 09:05:23
|
| sorry i forgot to put the update in thereUpdate Tbl_Txn_UTSet Fxd_Units =CASEWHEN TxnUnitsBase = NullTHEN Fxd_Units = left(TxnUnitsDur,len(TxnUnitsDur)-1)/15WHEN (TxnUnitsBase <> Null and TxnUnits like '%,%' and TxnUnits not like '%M%')THEN Fxd_Units = TxnUnitsBaseWHEN TxnUnitsBase <> NullTHEN Fxd_Units = left(TxnUnitsDur,len(TxnUnitsDur)-1)/15 + TxnUnitsBaseENDWhere TxnUnits like '%M%' or TxnUnits like '%,%' |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-08-12 : 09:09:51
|
| Replace = Null by Is Null and <> Null by is not nullMadhivananFailing to plan is Planning to fail |
 |
|
|
Job
Yak Posting Veteran
69 Posts |
Posted - 2005-08-12 : 09:38:20
|
| Ok, I just didn't have to restate the field names that are explicit in the set statment. So this works;Update Tbl_Txn_UTSet Fxd_Units =CASEWHEN TxnUnitsBase = NullTHEN left(TxnUnitsDur,len(TxnUnitsDur)-1)/15WHEN (TxnUnitsBase <> Null and TxnUnits like '%,%' and TxnUnits not like '%M%')THEN TxnUnitsBaseWHEN TxnUnitsBase <> NullTHEN left(TxnUnitsDur,len(TxnUnitsDur)-1)/15 + TxnUnitsBaseENDWhere TxnUnits like '%M%' or TxnUnits like '%,%' |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-08-12 : 09:42:11
|
| Are you sure that works?See my prevoius replyMadhivananFailing to plan is Planning to fail |
 |
|
|
Job
Yak Posting Veteran
69 Posts |
Posted - 2005-08-12 : 11:18:19
|
No Madhivanan,You are right, it didn't work on all of the recordsI had to change it..quote: Originally posted by madhivanan Are you sure that works?See my prevoius replyMadhivananFailing to plan is Planning to fail
|
 |
|
|
|
|
|
|
|