Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I have one (or can be more) databas

Status
Not open for further replies.

svagelis

Programmer
May 2, 2001
121
GR
I have one (or can be more) database on the sql server 7.0 and i want it to be accesible only from time 0800-2000.
Is this possible ? Automatically i mean by SQL server??
Thanks
 
There are a few possibilities using the sp_dboption system stored procedure.

Make the database unavailable to any user except the owner.
USE master
EXEC sp_dboption 'dbname', 'dbo use only', 'TRUE'

Take the database offline - no user can access it.
USE master
EXEC sp_dboption 'dbname', 'offline', 'TRUE'

Make the database read-only.
USE master
EXEC sp_dboption 'dbname', 'read only', 'TRUE'

You could create a scheduled Job that would run at 2000 and execute sp_dboption to set one of the options mentioned to TRUE. Another Job could run at 0800 to set the selected option to FALSE. Terry

"I'm not dumb. I just have a command of thoroughly useless information." - Calvin, of Calvin and Hobbes
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top