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. SQL - StoredProc - Data into a variable?

SQL - StoredProc - Data into a variable?

Scheduled Pinned Locked Moved Database
databasehelpquestion
5 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.
  • W Offline
    W Offline
    wbjohnson
    wrote on last edited by
    #1

    Hey everyone, im a little stuck here basically i have a SQL 2000 function like this: CREATE PROCEDURE GetTaskListForSupervisor as declare @rowcount int set @rowcount = select count(id) from TimeStudy //add logic if rowcount is > 2 GO Obviously, that doesnt pass the syntex check, but can you see what id like to do? just put the count of all the rows into a locally declared variable? Im a bit out of my depth here so could someone pull me back into shallow waters please :D Cheers Will

    R R A 3 Replies Last reply
    0
    • W wbjohnson

      Hey everyone, im a little stuck here basically i have a SQL 2000 function like this: CREATE PROCEDURE GetTaskListForSupervisor as declare @rowcount int set @rowcount = select count(id) from TimeStudy //add logic if rowcount is > 2 GO Obviously, that doesnt pass the syntex check, but can you see what id like to do? just put the count of all the rows into a locally declared variable? Im a bit out of my depth here so could someone pull me back into shallow waters please :D Cheers Will

      R Offline
      R Offline
      Rob Graham
      wrote on last edited by
      #2

      "select @rowcount = count(*) from TimeStudy" ;no advantage to count(id) over count(*)...

      1 Reply Last reply
      0
      • W wbjohnson

        Hey everyone, im a little stuck here basically i have a SQL 2000 function like this: CREATE PROCEDURE GetTaskListForSupervisor as declare @rowcount int set @rowcount = select count(id) from TimeStudy //add logic if rowcount is > 2 GO Obviously, that doesnt pass the syntex check, but can you see what id like to do? just put the count of all the rows into a locally declared variable? Im a bit out of my depth here so could someone pull me back into shallow waters please :D Cheers Will

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

        [Message Deleted]

        W 1 Reply Last reply
        0
        • R R_L_H

          [Message Deleted]

          W Offline
          W Offline
          wbjohnson
          wrote on last edited by
          #4

          thanks guys :) Excellent forum - excellent help!

          1 Reply Last reply
          0
          • W wbjohnson

            Hey everyone, im a little stuck here basically i have a SQL 2000 function like this: CREATE PROCEDURE GetTaskListForSupervisor as declare @rowcount int set @rowcount = select count(id) from TimeStudy //add logic if rowcount is > 2 GO Obviously, that doesnt pass the syntex check, but can you see what id like to do? just put the count of all the rows into a locally declared variable? Im a bit out of my depth here so could someone pull me back into shallow waters please :D Cheers Will

            A Offline
            A Offline
            Anshuman Singh
            wrote on last edited by
            #5

            you may use like this: declare @ROWCOUNT int select @ROWCOUNT = count(id) from syscolumns where id = 1 if @ROWCOUNT > 2 print @ROWCOUNT else print 'Less'

            Anshuman Singh [anshumas@rediffmail.com](mailto:Anshuman Singhanshumas@rediffmail.com)

            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