Link to home
Start Free TrialLog in
Avatar of LeTay

asked on

define a global variable in ms/sql 7.0

Is it possible to create my 'own' global variable in a ms/sql database environment ?
More precisely : I need to regularly run a more or less complex stored procedure in one database. The stored procedure should 'remember' the last datetime it was executed.
Of course, a solution for me is to store that value in a specific table I would create first, and retrieve it from there later on.
But I was thinking about a maybe more "elegant" solution with global variable that I could 'create' ?
Is this feasible ?
Avatar of ram2098

I don't think SQL Server have global variables..but, you can use global temp tables for this..

You can create Global Temp tables like

create ##temptable (fdate datetime)

These tables are available across the procedures, but till you restart SQL Server. These will not use the actual database, rather use TEMPDB.
Avatar of SjoerdVerweij

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