Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7547761
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T09:32:07+00:00 2026-05-30T09:32:07+00:00

I have a table with PostalCode Column that type’s is Char(10) , I use

  • 0

I have a table with PostalCode Column that type’s is Char(10), I use the following Select query:

SELECT [Fm].[Id], [Sdp].[FirstName], [Sdp].[LastName], [Sdp].[SSN],
[Sdp].[StoreName],
case when isnumeric([Sdp].[PostalCode]) = 1 then CONVERT(CHAR(10),[Sdp].[PostalCode]) 
else '0' end,  [Fc].[Id], [Sdp].[Address]

FROM [SRM].[SiteMembers].[DProfile] AS [Sdp]
INNER JOIN [SRM].[SiteMembers].[Member] AS [Sm]
ON [Sdp].[Member_Id] = [Sm].[Id]
INNER JOIN [FRM].[Members].[Member] AS [Fm]
ON [Sm].[UserId] = [Fm].[UserId]
INNER JOIN [SRM].[General].[City] AS [Sc]
ON [Sdp].[City_Id]=[Sc].[Id]
INNER JOIN [FRM].[General].[City] AS [Fc]
ON [Fc].[Title]=[Sc].[Title] 
COLLATE SQL_Latin1_General_CP1_CI_AS

Whit this script the Over flow error raised like this:

Msg 248, Level 16, State 1, Line 2
The conversion of the varchar value '4153675759' overflowed an int column.

I ask a question here and I don’t want back to past with 2 scripts, So is there any way to check the PostalCode is numeric (and I mean numeric not int) without any error?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T09:32:08+00:00Added an answer on May 30, 2026 at 9:32 am

    If you want to check that a (n)(var)char value consists of digits and only digits, then a simply double negative LIKE will work:

    PostalCode not like '%[^0-9]%'
    

    which will only be true if there are no non-digits within the string.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a address in more than one column in a table. SELECT FirstName,
I have a query that originally looks like this: select c.Id, c.Name, c.CountryCode, c.CustomerNumber,
I have a table of names and addresses, which includes a postcode column. I
I have table with some fields that the value will be 1 0. This
I have table with 3 columns A B C. I want to select *
I have the following script to create a table in MySQL version 5.1 which
I have a query that I'm not sure how to write. I'm not a
I have a database table that contains among other things partial postal codes. I'm
I have a query that takes too long and frequently times out. It's a
I have to do a insert query, inserting data from another table, condition: if

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.