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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T12:50:22+00:00 2026-05-31T12:50:22+00:00

The problem is we have many different error messages being produced and stored in

  • 0

The problem is we have many different error messages being produced and stored in a sql table
within the error message there could be an occurance of a project number 8 characters long
which would contain at least 1 number is alphanumeric and no spaces. per error message the project number may not be the same.

e.g.

'error found processing project: abcd12sf no funding is set'
'error found processing project: qd451srf no funding is set'
'error project 2344ddrf has no approver'

We want to be able to count the occurances of particular errors and so we need to strip the project number from the output

thus

'error found processing project: no funding is set' , 2 occurances
'error project has no approver' , 1 occurance

Any help is greatly appreciated

  • 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-31T12:50:23+00:00Added an answer on May 31, 2026 at 12:50 pm

    Start by creating a Function that returns the project number. I did this by finding the first integer and then position of the space after it, then counting back 8 characters you have the start and end position.

    CREATE FUNCTION GetProjectNumber(@FullErrorMessage varchar(100))
    
    RETURNS CHAR(8)
    
    AS 
    
    BEGIN
    
        DECLARE @ProjectNumber CHAR(8)
    
        SET @ProjectNumber = (
                                        SELECT  
                                        SUBSTRING(@FullErrorMessage, CHARINDEX(' ',@FullErrorMessage,PATINDEX('%[0-9]%',@FullErrorMessage))-8,8)
                                    )
    
        RETURN @ProjectNumber
    END
    

    Alter your table to have a computed column called ProjectNumber here is the create I did for testing but you should get the idea.

    CREATE TABLE T_Errors(
    ID int IDENTITY(1,1),
    ErrorMessage varchar(1024),
    ProjectNumber AS (dbo.GetProjectNumber(ErrorMessage))
    CONSTRAINT PK_T_Errors PRIMARY KEY CLUSTERED(ID))
    

    Now you have the project number in a separate column it is easy to play with.

    SELECT 
    CleanErrorMessage = REPLACE(ErrorMessage,ProjectNumber,''),
    COUNT(*) As ErrorCount
    FROM T_Errors
    GROUP BY REPLACE(ErrorMessage,ProjectNumber,'')
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

There are many skills a programmer could have (understanding the problem, asking good questions,
I have seen this problem arise in many different circumstances and would like to
I am getting this message: SEVERE: Error loading WebappClassLoader . Many people have posted
I have a complete Form Creation System. There are many different Question Types and
Many people have this same problem, but everyone's implementation is different. I need help
I'm sure this is the kind of problem other have solved many times before.
I have the problem that my view controller class has too many delegates and
This problem has bugged me so many times and i have now decided to
Here is my problem. I have created a pretty heavy readonly class making many
Problem: I have two spreadsheets that each serve different purposes but contain one particular

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.