Reputation:
I need to use some values (table values Ex: StudentId) in many Stored procedures. So I need to query that value in every stored procedure. In MVC I am able to store that value in WebConfig. But in SQL how can I do that?
Is there any option to store that value globally to refer it in a Stored procedure?
Upvotes: 1
Views: 844
Reputation: 1
It does not look like you can directly make global variables SQL server.
I found another question that is very similar to yours with useful information.
how to declare global variable in SQL Server..?
Hope this helps.
Upvotes: 0
Reputation: 256
If you need configuration values in a database, you can just create a new table and call it something like ConfigurationParameters
, then query whenever you need a value from it.
If you can't do that, then create a StoredProcedure or Function that always returns the value you need.
Upvotes: 1