What is the sql for changing a table to ready-only?
Many Thanks.One method with SQL 2000:
CREATE TRIGGER MyTable_Trigger ON MyTable
INSTEAD OF INSERT, UPDATE, DELETE
AS
SET NOCOUNT ON -- do nothing
GO
--
Hope this helps.
Dan Guzman
SQL Server MVP
--
SQL FAQ links (courtesy Neil Pike):
http://www.ntfaq.com/Articles/Index.cfm?DepartmentID=800
http://www.sqlserverfaq.com
http://www.mssqlserver.com/faq
--
"MC" <chan_mc@.hotmail.com> wrote in message
news:0d1b01c38956$d7a05e70$a401280a@.phx.gbl...
> What is the sql for changing a table to ready-only?
> Many Thanks.|||Cute.
"Dan Guzman" <danguzman@.nospam-earthlink.net> wrote in message
news:Ofr0UrViDHA.1300@.TK2MSFTNGP10.phx.gbl...
> One method with SQL 2000:
> CREATE TRIGGER MyTable_Trigger ON MyTable
> INSTEAD OF INSERT, UPDATE, DELETE
> AS
> SET NOCOUNT ON -- do nothing
> GO
> --
> Hope this helps.
> Dan Guzman
> SQL Server MVP
> --
> SQL FAQ links (courtesy Neil Pike):
> http://www.ntfaq.com/Articles/Index.cfm?DepartmentID=800
> http://www.sqlserverfaq.com
> http://www.mssqlserver.com/faq
> --
> "MC" <chan_mc@.hotmail.com> wrote in message
> news:0d1b01c38956$d7a05e70$a401280a@.phx.gbl...
> > What is the sql for changing a table to ready-only?
> >
> > Many Thanks.
>|||And, of course, possibly with a RAISERROR if an error should be submitted when a modification is
attempted.
--
Tibor Karaszi, SQL Server MVP
Archive at: http://groups.google.com/groups?oi=djq&as ugroup=microsoft.public.sqlserver
"Dan Guzman" <danguzman@.nospam-earthlink.net> wrote in message
news:Ofr0UrViDHA.1300@.TK2MSFTNGP10.phx.gbl...
> One method with SQL 2000:
> CREATE TRIGGER MyTable_Trigger ON MyTable
> INSTEAD OF INSERT, UPDATE, DELETE
> AS
> SET NOCOUNT ON -- do nothing
> GO
> --
> Hope this helps.
> Dan Guzman
> SQL Server MVP
> --
> SQL FAQ links (courtesy Neil Pike):
> http://www.ntfaq.com/Articles/Index.cfm?DepartmentID=800
> http://www.sqlserverfaq.com
> http://www.mssqlserver.com/faq
> --
> "MC" <chan_mc@.hotmail.com> wrote in message
> news:0d1b01c38956$d7a05e70$a401280a@.phx.gbl...
> > What is the sql for changing a table to ready-only?
> >
> > Many Thanks.
>|||Great. Thanks for your help.
Then, another question:
What is the sql for disable and enable that trigger? Any?
I'm trying not to create and delete the trigger everytime.
My purpose is to put the table in read only while a list
of tasks are performed and put the table back to update
mode when finished.
Thanks again.
MC
>--Original Message--
>One method with SQL 2000:
>CREATE TRIGGER MyTable_Trigger ON MyTable
>INSTEAD OF INSERT, UPDATE, DELETE
>AS
>SET NOCOUNT ON -- do nothing
>GO
>--
>Hope this helps.
>Dan Guzman
>SQL Server MVP
>--
>SQL FAQ links (courtesy Neil Pike):
>http://www.ntfaq.com/Articles/Index.cfm?DepartmentID=800
>http://www.sqlserverfaq.com
>http://www.mssqlserver.com/faq
>--
>"MC" <chan_mc@.hotmail.com> wrote in message
>news:0d1b01c38956$d7a05e70$a401280a@.phx.gbl...
>> What is the sql for changing a table to ready-only?
>> Many Thanks.
>
>.
>|||> What is the sql for disable and enable that trigger?
Try:
ALTER TABLE MyTABLE
DISABLE TRIGGER MyTable_Trigger
ALTER TABLE MyTABLE
ENABLE TRIGGER MyTable_Trigger
See the Books Online for details.
--
Hope this helps.
Dan Guzman
SQL Server MVP
"MC" <chan_mc@.hotmail.com> wrote in message
news:049101c389a2$e32ed3b0$a001280a@.phx.gbl...
> Great. Thanks for your help.
> Then, another question:
> What is the sql for disable and enable that trigger? Any?
> I'm trying not to create and delete the trigger everytime.
> My purpose is to put the table in read only while a list
> of tasks are performed and put the table back to update
> mode when finished.
> Thanks again.
> MC
>
> >--Original Message--
> >One method with SQL 2000:
> >
> >CREATE TRIGGER MyTable_Trigger ON MyTable
> >INSTEAD OF INSERT, UPDATE, DELETE
> >AS
> >SET NOCOUNT ON -- do nothing
> >GO
> >
> >--
> >Hope this helps.
> >
> >Dan Guzman
> >SQL Server MVP
> >
> >--
> >SQL FAQ links (courtesy Neil Pike):
> >
> >http://www.ntfaq.com/Articles/Index.cfm?DepartmentID=800
> >http://www.sqlserverfaq.com
> >http://www.mssqlserver.com/faq
> >--
> >
> >"MC" <chan_mc@.hotmail.com> wrote in message
> >news:0d1b01c38956$d7a05e70$a401280a@.phx.gbl...
> >> What is the sql for changing a table to ready-only?
> >>
> >> Many Thanks.
> >
> >
> >.
> >
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment