Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. column length select query

column length select query

Scheduled Pinned Locked Moved Database
databasecss
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    playout
    wrote on last edited by
    #1

    Hi, I would like to retrieve specific region names, where a region code is less then 3 characters. I cant just do a normal select query, as some of the codes are more then 3 characters. Here is my sql query, but its not returning anything. SELECT RegionName, RegionCode FROM Region WHERE DATALENGTH(RegionCode) < 3 ORDER BY RegionName

    Z 1 Reply Last reply
    0
    • P playout

      Hi, I would like to retrieve specific region names, where a region code is less then 3 characters. I cant just do a normal select query, as some of the codes are more then 3 characters. Here is my sql query, but its not returning anything. SELECT RegionName, RegionCode FROM Region WHERE DATALENGTH(RegionCode) < 3 ORDER BY RegionName

      Z Offline
      Z Offline
      Ziyad Mohammad
      wrote on last edited by
      #2

      Change query as below and try SELECT RegionName, RegionCode FROM Region WHERE len(RegionCode) < 3 ORDER BY RegionName

      Thanks, Ziyad Mohammad [http://www.dotnetsoldier.blogspot.com/]

      P 1 Reply Last reply
      0
      • Z Ziyad Mohammad

        Change query as below and try SELECT RegionName, RegionCode FROM Region WHERE len(RegionCode) < 3 ORDER BY RegionName

        Thanks, Ziyad Mohammad [http://www.dotnetsoldier.blogspot.com/]

        P Offline
        P Offline
        playout
        wrote on last edited by
        #3

        Thanks alot. It worked. I never thought of LEN()...

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups