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. Print numbers

Print numbers

Scheduled Pinned Locked Moved Database
tutorialquestion
3 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.
  • S Offline
    S Offline
    SatyaKeerthi15
    wrote on last edited by
    #1

    I have to call function to print numbers. For Example if I pass 5 as parameter function has to return 1 2 3 4 5 Is declaring Temp table and Get this result is good way? Is there any alternate

    B P 2 Replies Last reply
    0
    • S SatyaKeerthi15

      I have to call function to print numbers. For Example if I pass 5 as parameter function has to return 1 2 3 4 5 Is declaring Temp table and Get this result is good way? Is there any alternate

      B Offline
      B Offline
      Blue_Boy
      wrote on last edited by
      #2

      Here it is

      DECLARE @InputValue INT
      SET @InputValue=3

      DECLARE @PrintValue INT
      SET @PrintValue=1

      WHILE @InputValue > 0
      BEGIN

      	PRINT @PrintValue
      	SET @PrintValue=@PrintValue+1
      	SET @InputValue=@InputValue-1
      

      END


      I Love T-SQL "Don't torture yourself,let the life to do it for you." If my post helps you kindly save my time by voting my post. www.aktualiteti.com

      1 Reply Last reply
      0
      • S SatyaKeerthi15

        I have to call function to print numbers. For Example if I pass 5 as parameter function has to return 1 2 3 4 5 Is declaring Temp table and Get this result is good way? Is there any alternate

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

        That doesn't sound like a database question.

        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