Can I setup an internal variable in a stored procedure?

Todd_Anderson
Todd_Anderson used Ask the Experts™
on
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
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Database Consultant
Top Expert 2009
Commented:
declare @MyVariable varchar(50)
AneeshDatabase Consultant
Top Expert 2009

Commented:
in order to assign the value

SELECT @myVariable = NULL

Author

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

Thanks,

Todd

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial