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. getting the value in variable

getting the value in variable

Scheduled Pinned Locked Moved Database
questionsharepointdatabase
2 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.
  • G Offline
    G Offline
    gottimukkala
    wrote on last edited by
    #1

    I have a stored procedure that returns the max. number of publication views by author. I will not pass the author name, my stored procedure will select the top 1 like here. SELECT DISTINCT TOP 1 dbo.FnGetNoOfPublicationViewsByAuthor(C.CUSTOM2) AS 'TotalPublicationsViews', C.CUSTOM2 AS 'Author' FROM HDS_CUSTOM C GROUP BY C.CUSTOM2 I want to get the value of this Author seperately to use in other select statements in the same SP. how can I get it. Is there possibility? Thanks.

    K 1 Reply Last reply
    0
    • G gottimukkala

      I have a stored procedure that returns the max. number of publication views by author. I will not pass the author name, my stored procedure will select the top 1 like here. SELECT DISTINCT TOP 1 dbo.FnGetNoOfPublicationViewsByAuthor(C.CUSTOM2) AS 'TotalPublicationsViews', C.CUSTOM2 AS 'Author' FROM HDS_CUSTOM C GROUP BY C.CUSTOM2 I want to get the value of this Author seperately to use in other select statements in the same SP. how can I get it. Is there possibility? Thanks.

      K Offline
      K Offline
      Krish KP
      wrote on last edited by
      #2

      DECLARE @TotalPublicationsViews AS VarChar(100) DECLARE @Author AS VarChar(100) SELECT DISTINCT TOP 1 @TotalPublicationsViews = dbo.FnGetNoOfPublicationViewsByAuthor(C.CUSTOM2), @Author = C.CUSTOM2 FROM HDS_CUSTOM C GROUP BY C.CUSTOM2 SELECT @TotalPublicationsViews, @Author Declare variables as per their respective DataTypes

      Regards KP

      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