MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to use LIKE parameter for Numeric literals

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database
View previous topic :: View next topic  
Author Message
vkphani
Intermediate


Joined: 05 Sep 2003
Posts: 483
Topics: 48

PostPosted: Thu Sep 23, 2004 9:12 am    Post subject: How to use LIKE parameter for Numeric literals Reply with quote

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
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12380
Topics: 75
Location: San Jose

PostPosted: Thu Sep 23, 2004 9:48 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
a_seshu
Beginner


Joined: 30 Sep 2004
Posts: 16
Topics: 4
Location: Chennai

PostPosted: Sat Oct 02, 2004 7:33 am    Post subject: A straight forward solution Reply with quote

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
View user's profile Send private message Send e-mail Yahoo Messenger MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group