Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 variables in ms-sql

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2004-09-10 : 08:34:49
Will writes "I am trying to write a proc that has from declared variable, the declared variables will be populated from various tables, and i would like to know if there is a table that stores the variables and thier values at run time


ie

delcare proc xxx() as
begin
declare a varchar(90)
declare b varchar(90)
declare a varchar(90)

--now this is the tricky bit to return the variable
--I need to be able to select the value using the object is
--of the proc

select varname from sometable where object_id(xxx)

end


thanx in advance"

Seventhnight
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2004-09-10 : 08:43:43
I am confused.

what are ultimately trying to do? Lookup some values in one or more tables, store them in variables, and select them back out?

declare @a varchar(90), @b varchar(90)

Set @a = (Select someValue from someTable where someCondition=true)
Set @b = (Select someValue from someTable where someCondition=true)

Select @a, @b

Corey
Go to Top of Page
   

- Advertisement -