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. Converting Val function in access to SQL Server

Converting Val function in access to SQL Server

Scheduled Pinned Locked Moved Database
databasesql-serversysadminquestion
6 Posts 4 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.
  • M Offline
    M Offline
    Morore_Charles_007
    wrote on last edited by
    #1

    Hi i have this function Val(Right([ContractNo],6) and its in Access format how do i change it to SQL Server Thanx

    G S M 3 Replies Last reply
    0
    • M Morore_Charles_007

      Hi i have this function Val(Right([ContractNo],6) and its in Access format how do i change it to SQL Server Thanx

      G Offline
      G Offline
      GuyThiebaut
      wrote on last edited by
      #2

      try

      substring(ContractNo,len(ContractNo)-5,6)

      “That which can be asserted without evidence, can be dismissed without evidence.”

      ― Christopher Hitchens

      M 1 Reply Last reply
      0
      • M Morore_Charles_007

        Hi i have this function Val(Right([ContractNo],6) and its in Access format how do i change it to SQL Server Thanx

        S Offline
        S Offline
        Simon_Whale
        wrote on last edited by
        #3

        As Val only returns numbers until the first non number is found, there is no out of the box solution I would have a read of this Get only the number from a string, T-SQL???[^]

        Every day, thousands of innocent plants are killed by vegetarians. Help end the violence EAT BACON

        1 Reply Last reply
        0
        • M Morore_Charles_007

          Hi i have this function Val(Right([ContractNo],6) and its in Access format how do i change it to SQL Server Thanx

          M Offline
          M Offline
          Maciej Los
          wrote on last edited by
          #4

          Why? What kind of data are there?

          1 Reply Last reply
          0
          • G GuyThiebaut

            try

            substring(ContractNo,len(ContractNo)-5,6)

            “That which can be asserted without evidence, can be dismissed without evidence.”

            ― Christopher Hitchens

            M Offline
            M Offline
            Morore_Charles_007
            wrote on last edited by
            #5

            Thank you it works

            G 1 Reply Last reply
            0
            • M Morore_Charles_007

              Thank you it works

              G Offline
              G Offline
              GuyThiebaut
              wrote on last edited by
              #6

              Great, don't forget to upvote posts that help you ;)

              “That which can be asserted without evidence, can be dismissed without evidence.”

              ― Christopher Hitchens

              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