Link to home
Start Free TrialLog in
Avatar of VBBRett
VBBRett

asked on

Creating Values in stored procedures

I would like to create values inside stored procedures and assign them to certain variables in the stored procedure.  how would I do that?
Avatar of Aneesh
Aneesh
Flag of Canada image

SELECT @Variable = 100

SELECT @Variabl2 = SomeCOlumn
FROM SomeTable
WHERE someCondition
or with aggregations:

select @sumval = sum(somefield) from tablename

or from a function

select @value = dbo.udf_functionname()

get current date

select @date = getdate()

get current user

select @currentuser = suser_sname()
ASKER CERTIFIED SOLUTION
Avatar of Mark Wills
Mark Wills
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial