VInayK
VInayK

Reputation: 1559

Modify Stored Procedure on read-only SQL Server 2008 database

Can we modify stored procedure in a read-only copy? I think it will allow you to modify but will there be any issues?

Upvotes: 0

Views: 472

Answers (1)

gvee
gvee

Reputation: 17171

If your database is marked as read-only, you cannot make changes to data or objects.

If you need to make a change then you need to basically switch it back to read-write, make the change, then mark as read-only again.

USE your_database
;

ALTER DATABASE your_database
  SET READ_WRITE
    WITH ROLLBACK IMMEDIATE
;

ALTER VIEW some_view
  AS
SELECT 'bar' As foo
;

ALTER DATABASE your_database
  SET READ_ONLY
    WITH ROLLBACK IMMEDIATE
;

Upvotes: 1

Related Questions