Skip to Content
0
Former Member
Feb 09, 2011 at 03:46 AM

Zip Code Validation

221 Views

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