View previous topic :: View next topic |
Author |
Message |
vkphani Intermediate

Joined: 05 Sep 2003 Posts: 483 Topics: 48
|
Posted: Thu Sep 23, 2004 9:12 am Post subject: How to use LIKE parameter for Numeric literals |
|
|
Hi,
I want to update country code for subscribers starting with subsriber number 965.
I used like parameter as below.
UPDATE EPR_MNTG_REGN
SET EMR_SUBR_CTRY_CD = 'UK'
WHERE EMR_SUBR_NBR LIKE '965%'
But this is not working.
Can anybody please help me.
Thanks in advance. |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12380 Topics: 75 Location: San Jose
|
Posted: Thu Sep 23, 2004 9:48 am Post subject: |
|
|
Phani,
How is EMR_SUBR_NBR column defined? If it is defined as smallint or decimal , then the LIKE parm will not work. Post the all the column definitions involved in the update.
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
 |
a_seshu Beginner

Joined: 30 Sep 2004 Posts: 16 Topics: 4 Location: Chennai
|
Posted: Sat Oct 02, 2004 7:33 am Post subject: A straight forward solution |
|
|
Phani,
The solution I am giving here is a simple and straight forward approach. If the data is too large, you are gonna have performance issues.
Code: | UPDATE EPR_MNTG_REGN
SET EMR_SUBR_CTRY_CD = 'UK'
WHERE CAST(EMR_SUBR_NBR AS CHAR(20)) LIKE '965%'
|
Depending on the precision of the subscriber number, you can change the precision of the char to be more or less than 20. How ever, as Kolusu was mentioning, if there is any more input on the data type of subscriber number, we can definitely come up with the best sql for your requirement.
Thanks,
Seshu. _________________ I dont think I would ever stop learning. - Seshu. |
|
Back to top |
|
 |
|
|