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

  • Home
  • SEARCH
  • 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 7931043
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T20:36:26+00:00 2026-06-03T20:36:26+00:00

I want a SQL pattern expression to match all numbers between 1 and 999

  • 0

I want a SQL pattern expression to match all numbers between 1 and 999.

EDIT:

In MSSQL.

  • 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-06-03T20:36:28+00:00Added an answer on June 3, 2026 at 8:36 pm

    When using the LIKE operator pattern-matching in SQL for a character class, there’s no wildcard repeat of the character class like there is in regex. In other words, you can’t do things like [0-9]+ or [0-9]{1,3} (both of these would also capture 0)

    So, you have to zero-pad the number before you can compare it.

    It’s not directly a pattern, but this expression relies in part on the LIKE operator and will work for positive integers between 1 and 999:

    RIGHT('00' + myfield, 3) LIKE '[0-9][0-9][0-9]'
    AND RIGHT('00' + myfield, 3) <> '000'
    AND LEN(myfield) <= 3
    

    Edit: assumption made that you’re talking about Microsoft SQL Server, since you didn’t specify.

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

Sidebar

Related Questions

I want to use this pattern: SqlCommand com = new SqlCommand(sql, con); com.CommandType =
I want to match all names that have First Name , then 2 or
I want to find/replace a character/pattern ONLY inside SQL comments ( single line comments
I want to make connection with sql server DB and maintain in singleton pattern.
I want to send SQL server Dashboard & Health Report to my client on
I want to create SQL function with JDBC CREATE OR REPLACE FUNCTION TEST.TO_STRING( nt_in
I want to write an SQL query using the LIKE keyword. It should search
I want to run parameterized SQL with .NET. But when I use AddWithValue() the
I want to port this SQL query, which works just fine on SQL Server,
I want to write an SQL statement like below: select * from tbl where

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.