New: Overcoming Database DevOps Challenges. Read now.

SQL code to find upper case values

YoannaYoanna Posts: 1 New member
edited February 5, 2021 2:05AM in General Forum
Hi guys,

I am writing a select statement that looks through a column with guid strings and returns only those values that contain upper case symbols. The column contains many strings containing both upper and lower case symbols, but I want to extract only those with upper case. I am using MS SQL Management Studio. Your help will be appreciated!

Thanks.

Answers

  • predovicpredovic Posts: 1 New member
    edited March 30, 2021 2:27AM
    you should use the SUBSTRING function:  
              SUBSTRING (string, start, length)
    • string: can be a string, variable or column that you want to extract.
    • start: is an integer specifying the position where the substring should be returned from. Note that the first character in the string is 1, not 0.
    • length: a positive integer specifying the number of characters of the substring to be returned from the string.
      Note:
    • If the length parameter is negative then SUBSTRING will error
    • If start + length> the length of a string, then the substring will start at start and include the rest of the string.
    • See more about the LEFT and RIGHT functions as well to extract a substring from a specified string.
    • The SUBSTRING function can be used in the following versions of SQL Server: SQL Server 2017, SQL Server 2016, SQL Server 2014, SQL Server 2012, SQL Server 2008 R2, SQL Server 2008, SQL Server 2005.
      jigsaw puzzle
Sign In or Register to comment.