I have a session state management implementation using SQL Server. There is an ASPState database, and ASPStateTempApplications & ASPStateTempSessions tables in the tempdb database.

When I restart the SQL Service, tempdb database recreates, but these tables recreate too. I want to know: how do these tables recreate automatically each time?

I looked for start-up parameters and jobs, but did not find any.

2 Answers 2


Thanks for your input. Actually, I found the answer:

Those tables were created by a stored procedure that is set to execute on startup of the database engine service, configured via the sp_procoption system stored procedure.


They must have also been created in the model database. Anything in model gets created in any new database that's created (but not restored or attached), including tempdb on restart.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.