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 7877711
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T03:27:03+00:00 2026-06-03T03:27:03+00:00

I have a new project and just need some advice on how to do

  • 0

I have a new project and just need some advice on how to do it efficiently and fast.

I have a table with about 100,000 rows with about 50 to 60 fields. It is indexed and has a primary key. The primay key in this case is a barcode.

I have to create a query that goes through each row and check for rules at each step.

For example the first rule is checking if digit 3 of the primary key is 0. So code wise it would be SUBSTRING(PkgBarcode, 3, 1) = 0

If this rule fails, I’d like to print out a message.
Also regardless if this rule fails or passes, I’d like to continue on because the rules are not dependent on each other, ie it might fail rule 2 but pass rule 3 which is okay.

I am seeking best design practices. Would it be efficient to just use select statements with print messages or some sort of loop?
How would you do this fast and efficiently?

  • 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-03T03:27:05+00:00Added an answer on June 3, 2026 at 3:27 am

    You don’t want to do this “through each row” but rather with standard set theory. For example, you could add a BIT column for each test you need to run, and then run a query to update that bit based on the test:

    UPDATE tblMyTable
    SET [IsThirdDigitZero] = 0
    WHERE SUBSTRING(PkgBarcode, 3, 1) <> 0
    

    That makes it easy to pull a list of the ones that do not meet a certain test while avoiding a cursor.

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

Sidebar

Related Questions

I have just created a new project with a many-to-many relation (User-Group) and the
I have just started a new project, and I am using the Delphi 2009
I have just created a new project in VS2010 using the Visual c# >
Ok just got assigned to a new project and have never dealt with Javascript
I'm new to iPhone dev and need some help with adding subViews. I have
I have some down time and I am think of picking a new project
I am just starting up a new project that needs some cross-platform GUI, and
i have one doubt,i have created new project in eclipse with android 2.3.1 and
I have a new c++ project built with autoconf, automake and libtool. Functionality is
I have started a new mvc project and clicked on project\properties\web - use local

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.