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. assigning value to variable in stored procedure

assigning value to variable in stored procedure

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

    I am trying to get info into a variable in a sql server 2000 stored procedure How can this be done. I thought i had it but it doesnt seem to work. This is what i have. Declare @var1 int Select @var1 Select max(List_ID) from table1 @var1 stays NULL What am i doing wrong?

    P R 2 Replies Last reply
    0
    • B brsecu

      I am trying to get info into a variable in a sql server 2000 stored procedure How can this be done. I thought i had it but it doesnt seem to work. This is what i have. Declare @var1 int Select @var1 Select max(List_ID) from table1 @var1 stays NULL What am i doing wrong?

      P Offline
      P Offline
      Pete OHanlon
      wrote on last edited by
      #2

      Here you go:

      SELECT @Var2 = MAX(Lis_ID) from table1
      

      Please visit http://www.readytogiveup.com/ and do something special today. Deja View - the feeling that you've seen this post before.

      B 1 Reply Last reply
      0
      • B brsecu

        I am trying to get info into a variable in a sql server 2000 stored procedure How can this be done. I thought i had it but it doesnt seem to work. This is what i have. Declare @var1 int Select @var1 Select max(List_ID) from table1 @var1 stays NULL What am i doing wrong?

        R Offline
        R Offline
        RepliCrux
        wrote on last edited by
        #3

        Set @var1 = (SELECT max(List_ID) from table1) Select @var1 This is one way too

        B 1 Reply Last reply
        0
        • R RepliCrux

          Set @var1 = (SELECT max(List_ID) from table1) Select @var1 This is one way too

          B Offline
          B Offline
          brsecu
          wrote on last edited by
          #4

          Thanks a lot it worked I appreciate the help

          1 Reply Last reply
          0
          • P Pete OHanlon

            Here you go:

            SELECT @Var2 = MAX(Lis_ID) from table1
            

            Please visit http://www.readytogiveup.com/ and do something special today. Deja View - the feeling that you've seen this post before.

            B Offline
            B Offline
            brsecu
            wrote on last edited by
            #5

            Thanks a lot it worked I appreciate the help

            P 1 Reply Last reply
            0
            • B brsecu

              Thanks a lot it worked I appreciate the help

              P Offline
              P Offline
              Pete OHanlon
              wrote on last edited by
              #6

              Not a problem - I'm glad to help.

              Please visit http://www.readytogiveup.com/ and do something special today. Deja View - the feeling that you've seen this post before.

              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