Zip Code Validation

Hello Experts,
I would like to validate Zip Code on CRD1 table so that it should not contain any characters other than numbers.
When above condition is not met the users must be blocked from add or updating zipcode. Below is the procedure i worked on, but this logic not working, still taking characters. Please help me .
IF @transaction_type IN (N'A', N'U') AND @object_type = '2'
BEGIN
If Exists
(Select t0.ZipCode from CRD1 t0
Where t0.CardCode=@list_of_cols_val_tab_del and t0.ZipCode NOT LIKE '%[0-9]%')
begin
SET @error = 1
SET @error_message = N'Zip Code cannot contain Characters, Please enter a five digit number'
end
END

Hi Praneeth......
Try this.....
If @object_type='2' and @transaction_type in ('A','U')
BEGIN
If Exists (Select T0.City from [dbo].[CRD1] T0
Where (T0.ZipCode Like '%A%' or T0.ZipCode Like '%B%' or T0.ZipCode Like '%C%'
or T0.ZipCode Like '%D%' or T0.ZipCode Like '%E%' or T0.ZipCode Like '%F%'
or T0.ZipCode Like '%G%' or T0.ZipCode Like '%H%' or T0.ZipCode Like '%I%'
or T0.ZipCode Like '%J%' or T0.ZipCode Like '%K%' or T0.ZipCode Like '%L%'
or T0.ZipCode Like '%M%' or T0.ZipCode Like '%N%' or T0.ZipCode Like '%O%'
or T0.ZipCode Like '%P%' or T0.ZipCode Like '%Q%' or T0.ZipCode Like '%R%'
or T0.ZipCode Like '%S%' or T0.ZipCode Like '%T%' or T0.ZipCode Like '%U%'
or T0.ZipCode Like '%V%' or T0.ZipCode Like '%W%' or T0.ZipCode Like '%W%'
or T0.ZipCode Like '%X%' or T0.ZipCode Like '%Y%' or T0.ZipCode Like '%Z%')
And  T0.CardCode = @list_of_cols_val_tab_del)
BEGIN
Select @error = -1,
@error_message = 'Zip Code cannot contain Characters, Please enter a five digit number'
End
End
Hope this will help you....
Regards,
Rahul

Similar Messages

  • Expression - Zip Code validation

    We have the field called Zip Code and this is a text field and 10 Chrs long.
    Field 1:  State
    Field u2018Stateu2019 is a lookup field and  the lookup table has Country, state code and state name.
    Field 2:  Zip Code
    Zip Code = text field and the length is 10 chrs.
    The ZIP Code Validation should be either NNNNN format (Block of 5 digits) for standard ZIP Code OR
    NNNNN-NNNN format (Block of 5 and 4  digits) for ZIP+4 format
    For example, if the country = US and state = IL then the first digit of the postal code field will be 6 then remaining 4 digits must be numeric for the standard 5 digit Zip code.
    Can anybody help me to write the expression. Full points will be rewarded.

    Hi,
    Try this it should work,
    For example, if the country = US and state = IL then the first digit of the postal code field will be 6 then remaining 4 digits must be numeric for the standard 5 digit Zip code.
    I am assuming here State = IL indicates state code = IL which is field in your Lookup table. As you said your Lookup table having fields Country, state code and state name
    IF(FIND(State.Country, "US") AND FIND(State.state code, "IL"), LEFT(Zip Code,1)=6 AND HAS_ALL_CHARS(RIGHT(Zip Code,4),0,9), FALSE)
    otherwise if your State having IL value is simple text field in maintable then replace it as
    IF(FIND(State.Country, "US") AND FIND(State, "IL"), LEFT(Zip Code,1)=6 AND HAS_ALL_CHARS(RIGHT(Zip Code,4),0,9), FALSE)
    Hope it will Help you,
    Rewards if Useful......
    Mandeep Saini

  • Re:Zip Code Validation Against City

    Dear Frnds,
        I Came accross a query in address validation , Can we validate the zipcode(Postal Code) against City.
        Is it a Standard SAP Solution, Please any one guide me to drive this ?
    Thnks n Rgds
    Ram

    Hi Ram,
    Reffer to the documetn<a href="http://help.sap.com/saphelp_crm50/helpdata/en/5f/071ef3117c11d5b37d0050dadef62b/frameset.htm">Business Add-In ADDRESS_CHECK</a> and <a href="http://help.sap.com/saphelp_crm50/helpdata/en/a2/4afe28084ec6419477451b462c1d85/frameset.htm">postal check</a>
    This will give you the answer of your question.
    <b>Reward points if it helps!!</b>
    Best regards,
    Vikash.

  • Pick random visitor by zip code

    im looking to have, when a random user enteres their zip code
    on my site, if they are "the chosen one" they win a coupon. i need
    to have a list of zip codes, since this is in a loal are of about 6
    towns. then if the zip code is in the list, randomly someone is
    picked, can it also be once a month. ive looked at the zip code
    validators and the random number generator in action script but im
    not sure how to put them together.
    thanks alot

    sorry,
    i have a site for local towns, where the local shops
    advertise,
    i would like to offer a coupon, to the random person who
    visits.
    on random person a month, when they visit the site, a pop up
    will appear,
    " you won a coupon for $X "
    but, the person needs to enter a zip code because someone
    from california cant use a coupon from connecticut.
    In the documents, i found the zip code validator, and in AS i
    could use a random number generator, if i am correct, but i am not
    sure how to use them together so if some one enters their zip code,
    and its with in the local area, they could be randomly chosen to
    win a certificate.
    thanks

  • Having problem buying online.need your help since it's my first time here.apple is asking for my billing address but when i enter my address here in qatar,it's saying i should enter a valid zip code within the u.s.does it mean i can't buy online

    having problem buying online.need your help since it's my first time here.apple is asking for my billing address but when i enter my address here in qatar,it's saying i should enter a valid zip code within the u.s.does it mean i can't buy online even if it wil be shipped within u.s. only?

    To buy in for delivery in Qatar, you should be starting from the Apple Qatar site:
    http://www.apple.com/qa/
    Do you have an Apple-ID? if you do, then you should not have to enter your Address again, and may be able to sidestep the US Zip Code issue.

  • Safari 2.0 zip code bug?

    This is a problem I've started to notice on a bunch of webpages (including newegg.com) with Safari 2.0. Many times Safari will not let me enter my zip code into an HTML form field because it starts with a zero (like about half the zip codes in the U.S. northeast). Let us say my zip code is 02142 -- when I enter it in, Safair "autocorrects" it to "2142" after the control loses focus. Nothing seems to undo this, and I can't find any setting that fixes it. So the site I submit it to says, "Hey, that's not a valid zip code!" I've tried it with Firefox and Internet Explorer and neither seem to do this behavior (so I often have to leave whatever transaction I was trying to go through, open up Internet Explorer, and re-do the entire transaction -- all because Safari doesn't trust me to know what I want to type in).
    The HTML code from newegg.com which is doing this: <input name="zipcode1" type="text" size="4" maxlength="5" value=""> So it's nothing in particular about the form coding that I can tell -- it looks like Safari is just assuming that because I'm typing in a number, I can't possibly want it to start with a zero. Which is just ridiculous in a large number of contexts.
    Any way to turn this off? It is really getting irritating, and it's the sort of "application knowing what I want to do better than I do" idiocy which I think of being exclusively in the domain of Microsoft products. Which ironically don't seem to have this problem!
    NOTE: I am not using an Autofill zip code. I am just trying to enter it in manually.

    I can confirm this bug (isn't it irritating?). One solution is to use another browser; I've never had this problem in Firefox. Another would be to turn off AutoFill; even though you're not using an AutoFill entry, AutoFill seems to have this unfortunate effect on leading zeros entered manually.
    Next time you run across a page that won't take your zip code, click on Safari/Report bugs to Apple and send a bug report. Maybe if enough of us on the East Coast complain, someone will fix it.

  • Zip Code errors

    Hi there!
    I tried buying a song off of ITunes today. The last time I purchased something was in early June.
    However, when I tried, the login screen popped up and told me that "The zip code you provided does not match your bank's records."
    When I log in and get my account info, the zip code is correct. I thought briefly that now they expect you to have those extra 4 digits on the end of the zip code, so I added them and tried again, but it then said zip codes have to be 5 numbers long.
    So I've got no idea here. Yes, I know I can try another credit card, but there's no guarantee that would fix things and frankly, since all of my information remains the same (and certainly has since June, when I effortlessly made a purchase) I really shouldn't have to.
    Any thoughts on why this is happening?
    Thanks.

    I have had the same problem now... but I think I know why for me anyways. On July 1, my zip code changed and my bank switched to the correct zip code. However many sites on the internet don't recognize my new zip code as being valid. When I plug in the new one it says my address doesn't appear to be in the US, but if I plug in the old one it says the address doesn't match bank records. So I'm going to have to call technical support and make sure they get the zip code correct, or just wait until they add the new zip code.
    Hope this helps, but it doesn't sound like we're in the same boat, just same message.
    Troy

  • FM to Update infotype-0006 without ZIP Code

    Hi All,
    I am trying to create new entry in info type - 0006 (address) without using state and zip code.. I have tried with FM 'HR_INFOTYPE_OPERATION' . Using this I am able to save address without state but it is still giving zip code error is mandatory.. Even though I can create entry with out using state and zip using PA30..
    Please assist..
    -Rajesh

    Hi Ronaldo,
    Looking to this FM it is calling FM - 'HR_MAINTAIN_MASTERDATA' which in turn calling BDC..
    I was able to create record without state but not able to by pass state code validation.
    I am performing this action from external application so looking for FM or options by which I dont need to go for enhancement..
    -Rajesh

  • REGEX - find zip code in text

    Hi experts!
    I have to find the zip code (for germany) in a given text. I found 5 digits in my text, but my problem is to ignore numbers which consists of more than 5 digits!
    My first try works for all cases but not for the last one.
    FIND FIRST OCCURRENCE OF REGEX '([0-9]{5})' IN ld_string SUBMATCHES ld_plz.
    D-12345 Mainz -> should match 12345
    D 12345 Mainz -> should match 12345
    12345 Mainz -> should match 12345
    12345Mainz -> should match 12345
    Mainz D-12345  -> should match 12345
    D-123 45 Mainz -> error because of the space between the numbers
    D-12333345 Mainz -> error because only 5 digits are valid for a germany zip code; my REGEX does not work!
    Thanks a lot!
    Regards,
    Florian

    Hi Florian,
    curiosity persists.
    After some playing around I reduced the pattern using Placeholder for any single digit \d. Then I noticed that the 5-digit-sequence will also match 5 digits out of 6, so i used \D Placeholder for any character other than a digit Then I don't know how to recognize (optional) line start or end as alternative to non-digit, so I just enclose the string to be checked into spaces - please suggest a more elegant solution.
    My test form
    FORM regex .
      DATA:
        lv_subm   type string,
        lt_string TYPE TABLE OF string.
      FIELD-SYMBOLS:
        <string>  TYPE string.
      APPEND:
        'D-12345 Mainz' TO lt_string,
        'D 12345 Mainz' TO lt_string,
        '12345 Mainz'   TO lt_string,
        '12345Mainz'    TO lt_string,
        '123456Mainz'    TO lt_string,
        '123 45Mainz'    TO lt_string,
        'Mainz D-12345' TO lt_string.
      LOOP AT lt_string ASSIGNING <string>.
        clear:
          lv_subm.
        CONCATENATE ` ` <string> ` ` into <string>.
        FIND REGEX '\D(\d{5})\D' IN <string> SUBMATCHES lv_subm.
        WRITE: / <string>, 20 'matches', 30 lv_subm,40 'SY-SUBRC=', sy-subrc.
      ENDLOOP.
    ENDFORM.                    " REGEX
    creates this output:
    D-12345 Mainz     matches   12345     SY-SUBRC=     0
    D 12345 Mainz     matches   12345     SY-SUBRC=     0
    12345 Mainz       matches   12345     SY-SUBRC=     0
    12345Mainz        matches   12345     SY-SUBRC=     0
    123456Mainz       matches             SY-SUBRC=     4
    123 45Mainz       matches             SY-SUBRC=     4
    Mainz D-12345     matches   12345     SY-SUBRC=     0
    As I do not fully understand the meaning of FIRST OCCURRENCE, I just removed it.
    Regards,
    Clemens

  • Problem attempting to validate a simple zip code

    Surely I'm missing something obvious but I've defined the validation pattern 'text{99999-9999} | text{99999}' on a text field for zip code entry. If I enter '12345' it works OK but '12345-1234' generates a validation error.
    I'm also trying to define a valiation pattern for email addresses such as....
    0+'@'0+'.'0+
    ... and having no luck. It always generates an error.

    Rob,
    You could try the following JavaScript (which uses a 'regular expression' to define a validation pattern) on the *exit event of your e-mail address field. In this example the email adress 'email' is on the first page of the form which has been named 'Page_01'. The names on your form could well be different.
    // Validate the email address.
    var e_mail = new RegExp();
    // Set the regular expression to look for an email address in general form.
    e_mail.compile("^[a-z0-9_\\-\\.]+\\@[a-z0-9_\\-\\.]+\\.[a-z]{2,3}$","i");
    // Test the rawValue of the current object to see if it fits the general form of an email address.
    if (e_mail.test(email.rawValue) == false)
    {xfa.host.messageBox("Please enter a genuine E-mail Adress.","Invalid Information",0);
    xfa.host.setFocus("form1.Page_01.email");
    Regular expressions can look pretty daunting, but are a very powerful JavaScript feature that can prove to be invaluable for setting up data validation criteria. Any JavaScript (or Jscript) reference book or on-line tutorial will have a section showing you how to build them.
    Hope this helps,
    John

  • CER 8.5 unable to put in Canada Zip code

    Hi,
    I've a client running CER 8.5 on VMWare. The System Locale is set to "United States".
    Client is adding an ALI for Canada but the ZIP code and ZIP code extension are not taking the valid canadian Zip codes which are Alpha Numberic.
    For example, one of the Valid Canadian Zip Code is: L6M2W1, when client tries to put it in, he gets the followoing message:
    "Please enter a valid numeric value for Zip Code".
    As per the CER 8.5 Administration guide, the Zip Code and Zip Code extension fields will take following values:
    Zip Code  ----- The postal zip code for the address.  ---- You are limited to 5 characters.
    Zip Code Extension --- The postal zip code "plus four" number.  ---- You are limited to 4 digits.
    The country Code and State are correctly set to CA/ON but still same error. Trying to update the existing ALIs are also throwing the same error.
    I am not sure what version they were running earlier, but he did say he never had this issue in previous CER version.
    Has someone else noticed it and is aware of any possible fix for it? Or client needs to change the Locale from "United States" to "Canada" to fix it?
    Thanks in advance,
    Kapil

    Thanks for your time replying.
    I figured it out and asked the client to ignore it.
    Not sure if he is going to like it, but what's Cisco's say on it?
    If I get it somewhere documented clearly that it's meant only for United States locations, it'll make things clear.
    Thanks,
    Kapil

  • Reverse lookup by zip code

    is there a way to enter the zip code (in address book) and have it automatically lookup and enter city and state into the proper filds?....... maybe even the plus four extension

    This is a great example of a requirement for an Address Book plug-in. The difficulties with writing a reliable, functional one are several, however. I've toyed with the concept, but quickly became frustrated with the variables and the relatively unpredictable response to queries, even accurate, highly structured queries: the kind user are unlikely to perform.
    First, you have the multiple city [both valid and invalid] response from the USPS for any given five-digit ZIP in inquiry. Which would you pick from a multiple response list? [Most queries result in a list in my experience, and not in a single matching record.] The first? Or, would you offer a user the choice to pick any of the valid cities on the list?
    Second, since the ZIP plus 4 requires address matching by street number, street name and apartment, suite or other sub-unit, how would you handle the multiple page responses from USPS which are typical for 'almost complete' but not absolutely matching addresses in the database?
    Frankly, it's much easier to simply query the information here for associated cities and states…
    http://zip4.usps.com/zip4/citytown_zip.jsp
    …or, here, for ZIP plus 4 matches:
    http://zip4.usps.com/zip4/welcome.jsp
    You can then very quickly pick from a list of possible matches and enter the data in your Address Book records. Some processes are simply far easier to achieve on a non-automated, human basis than by running a script or application. This is probably one of those.

  • Off topic question - I need to know US zip code format

    I would suggest it is obvious I do not live in the US.
    When looking on the net everything I find show a US postal zip code as 5 long.
    However I seem to remember seeing codes that were longer than 5 long.
    Example 3241-76543 ?
    rykk

    Have a look at the ZIP faq on the USPS site ( http://zip4.usps.com/zip4/zipfaq.htm ). It has information about zip codes, ZIP+4 (what you're referring to) and zip validation services.

  • ZIP code override on Payment info

    Hi Anyone:
    have dead ended with both email attempts to Itunmes supprt and actually nice (but ultimately non helpful despite case #'s etc.) live people in Access telephone support. Trying to update just new exp date on card ( all other info stays same) but secondary screen (makes u pick a county for tax purposes) forces an override to the zipcode ( from some table i guess) and causes a mismatch with my card data...and blocks any purchases, attempts to add $, etc. Anyone run into this? Or have another # where I can try a live body one more time? Any help will be appreciated.

    I have had the same problem now... but I think I know why for me anyways. On July 1, my zip code changed and my bank switched to the correct zip code. However many sites on the internet don't recognize my new zip code as being valid. When I plug in the new one it says my address doesn't appear to be in the US, but if I plug in the old one it says the address doesn't match bank records. So I'm going to have to call technical support and make sure they get the zip code correct, or just wait until they add the new zip code.
    Hope this helps, but it doesn't sound like we're in the same boat, just same message.
    Troy

  • Trying to set download apps...says it needs my credit card info...I put it in....but then it won't take it because it says I need to enter my zip code.  I live in Canada and have a postal code, not a zip code.  Help

    I am trying to set up my new Iphone 4 and download apps.  I made an Apple Id which is all good.  But when I try and enter in my credit card info it keeps asking for my Zip code and state.  I live in Canada not US.  I changed the phone to Canadian but it still keeps asking for it and won't let me put in my right information which in turn won't let me download any apps.  Can anyone help?

    Postal & Zip codes are same.  Just enter postal code without space.  It will accept.

Maybe you are looking for

  • How do I restore iTunes after upgrading to Lion?

    Upgraded from Snow Leopard to Lion and, in the process, appear to have lost access to my iTunes.  After the upgrade, when I clicked on the iTunes icon, I was then asked if I wanted to "install iTunes!"  I have found folders that appear to contain the

  • Optimal Ethernet Network for FCS Usage

    Hi I recently purchased a G5 Dual 1.8 G5 PCI-X. I also have a G4 QuickSilver 867 with an upgraded processor (Sonnet 1.8 Ghz). According to the specs, they both have Gigabit Ethernet built in. My question is this.... To maximize the transfer of files,

  • How to generate an (re-) synchronized pulse train

    Hello, using a PCI-6601 I want to generate an endless pulse train of (e.g. 80Hz, high==low) synchronized to an external clock (ca.1Hz, ca 5ms pulse width). The output should _re_synchronize with the clock if there is a clock signal but if one clock-p

  • Trying to change dimmension of published swf using html

    Hi I have a small problem, A white border appears in my second swf when I a view it in the browser window I know how to change this on my first swf ( my preloader ) in html, but once it loads my second swf I dont know how to acsses its properties ple

  • Just curious, want to learn about XServe, nodes, etc.

    Hi, I don't know hardly anything about servers or how they work. I'd like to learn about what servers do, why they need to be powerful, what nodes are, and just about everything. I am hoping someone can point me to a site or article of some sort that