Link to home
Start Free TrialLog in
Avatar of Todd_Anderson
Todd_Anderson

asked on

Can I setup an internal variable in a stored procedure?

Is there a way to have a variable in a stored procedure that is not an input variable?  I just need it for use inside my stored procedure but when I set it up like this

     @MyVariable varchar(50)

it shows up as an input when the stored procedure is run from Management Studio.  I tried this

     @MyVariable varchar(50) = Null

which then allows the user to start the stored procedure without entering a value for the varible but I don't want it to show up at all.  It just needs to be there for internal use only.

Thanks,

Todd
ASKER CERTIFIED SOLUTION
Avatar of Aneesh
Aneesh
Flag of Canada 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
in order to assign the value

SELECT @myVariable = NULL
Avatar of Todd_Anderson
Todd_Anderson

ASKER

So simple!  I should have asked sooner.  Not sure why I couldn't find it in all my books and Googling.

Thanks,

Todd