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. Declare Varibales In SQL 2000

Declare Varibales In SQL 2000

Scheduled Pinned Locked Moved Database
databasequestion
1 Posts 1 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.
  • H Offline
    H Offline
    Hemant Mane
    wrote on last edited by
    #1

    Hi friends I make a function in sql 2000. I pass One parameter to that function and i return a table from that function i have 3 different tables. 1 is master table. e.g i have table of doctor i.e master and another 2 are 1 is specialization and another is status in specialization there are specialities of doctror like GP, Physician etc and in status the status of doctor is Important and very Important etc I want result like this Important very Important GP 4 5 Phy 3 2 first row indicate 4 Gp doctors are important and 5 are very important i make a function to return this result but i dont know how many Specialities in table and how many status so i want to alter temperory table in the function create function abc(@docid) returns table @tab (no varchar(10)) as begin declare @spec varchar(20) declare @vis varchar(20) declare @no int declare @ctr int select @ctr = count(visittypeid) from doc_visitytype where visitytypeid <> 0 while (@ctr >= 0) begin select @vis = visittype from doc_visittype where visittypeid = @ctr ALTER TABLE @tab ADD @vis varchar(10) end return end this code add the columns in the temporary table but @vis is local veriable how can i assign a veriable that it should take value of @vis as a coloumn name Thank You

    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