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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T20:45:20+00:00 2026-05-24T20:45:20+00:00

How to check upper case existence length in a string using Sql Query? For

  • 0

How to check upper case existence length in a string using Sql Query?

For Eg:

1.KKart – from this string the result should be 2, because it has 2 upper case letters.
2.WPOaaa – from this string the result should be 3, because it has 3 upper case letters.

Thanks in advance

  • 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-24T20:45:20+00:00Added an answer on May 24, 2026 at 8:45 pm

    There is no built-in T-SQL function for that.
    You can use a user-defined function like this one:

    CREATE FUNCTION CountUpperCase
    (
        @input nvarchar(50)
    )
    RETURNS int
    AS
    BEGIN
    
        declare @len int
        declare @i int
        declare @count int
        declare @ascii int
    
        set @len = len(@input)
        set @i = 1
        set @count = 0
    
        while @i <= @len
        begin
    
            set @ascii = ascii(substring(@input, @i, 1))
    
            if @ascii >= 65 and @ascii <= 90
            begin
                set @count = @count +1
            end
    
            set @i = @i + 1
    
        end
    
        return @count
    
    END
    

    Usage (with the examples from your question):

    select dbo.CountUpperCase('KKart') returns 2.
    select dbo.CountUpperCase('WPOaaa') returns 3.

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

Sidebar

Related Questions

Check this code (My Custom Keyboard): -(IBAction) updateTextBackSpace:(id)sender { if([txtview.text length]>0) { NSString *deletedLastCharString
First check out this code. I seems like it should work for me, but
I want to check if 'ep' is a upper case letter. So I check
Looking for a way to check if an string contains in another ignoring upper/lower
Check out this test: [TestFixture] public class Quick_test { [Test] public void Test() {
check this out: template <class T> class Test: public T { public: void TestFunc()
check this example: > a = matrix(1:9, nrow = 3, ncol = 3, dimnames
Check this link! I am having the hardest time trying to figure out why
Update: Check out this follow-up question: Gem Update on Windows - is it broken?
Please check this code out it compiles and runs absolutely fine.. The question is

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.