| Author |
Topic  |
|
|
midan1
Starting Member
39 Posts |
Posted - 04/14/2008 : 18:39:23
|
need help
replace characters on condition in table and cells
but only if
if i put number or 1 , 2 , 3 , 4 above the cell of the eployee for example( employee id=222 name =bbbb day1)
i replace characters with '0' and '#'
and it must work dynamically AND replace ONLY THIS characters
table before the replace id fname val day1 day11 day111 day2 day22 day222 ------------------------------------------------------ 111 aaaa 2 1 3 111 aaaa 1 A C 222 bbbb 2 222 bbbb 1 333 cccc 2 333 cccc 1 444 dddd 2 444 dddd 1 555 eeee 2 2 555 eeee 1 B table after the replace id fname val day1 day11 day111 day2 day22 day222 ------------------------------------------------------ 111 aaaa 2 0 0 111 aaaa 1 # # 222 bbbb 2 222 bbbb 1 333 cccc 2 333 cccc 1 444 dddd 2 444 dddd 1 555 eeee 2 0 555 eeee 1 # tnx FOR THE HELP
|
Edited by - midan1 on 04/14/2008 19:11:41
|
|
|
SwePeso
Patron Saint of Lost Yaks
Sweden
29138 Posts |
Posted - 04/14/2008 : 18:45:41
|
UPDATE Table1 SET day1 = CASE WHEN day1 IS NULL THEN NULL WHEN day1 NOT LIKE '%[^0-9]%' THEN 0 ELSE '#' END, day11 = CASE WHEN day11 IS NULL THEN NULL WHEN day11 NOT LIKE '%[^0-9]%' THEN 0 ELSE '#' END, day111 = CASE WHEN day111 IS NULL THEN NULL WHEN day111 NOT LIKE '%[^0-9]%' THEN 0 ELSE '#' END, day2 = CASE WHEN day2 IS NULL THEN NULL WHEN day2 NOT LIKE '%[^0-9]%' THEN 0 ELSE '#' END, day22 = CASE WHEN day22 IS NULL THEN NULL WHEN day22 NOT LIKE '%[^0-9]%' THEN 0 ELSE '#' END, day222 = CASE WHEN day222 IS NULL THEN NULL WHEN day222 NOT LIKE '%[^0-9]%' THEN 0 ELSE '#' END
E 12°55'05.25" N 56°04'39.16" |
 |
|
|
midan1
Starting Member
39 Posts |
Posted - 04/14/2008 : 18:53:26
|
tnx Peso but i need only to replace not update how ? tnx
|
 |
|
|
SwePeso
Patron Saint of Lost Yaks
Sweden
29138 Posts |
Posted - 04/14/2008 : 18:55:37
|
Replace content of a "field" is done by UPDATE.
E 12°55'05.25" N 56°04'39.16" |
 |
|
|
midan1
Starting Member
39 Posts |
Posted - 04/14/2008 : 19:06:51
|
but it must be depending on tow rows OF THE EMPLOYEE the employee have tow rows val=1 val=2 not only replace the characters only if i put number or 1 , 2 , 3 , 4 above the cell of the employee
ID fname val day1 day11 day111 --------------------------------- 111 aaaa 2 1 3 111 aaaa 1 A C
like this condition not work !!! because i don't HAVE number or 1 , 2 , 3 , 4 above THE cell
ID fname val day1 day11 day111 --------------------------------- 111 aaaa 2 111 aaaa 1 A C
tnx
|
Edited by - midan1 on 04/14/2008 19:10:42 |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
Sweden
29138 Posts |
|
| |
Topic  |
|