Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
DB Engine
SQL ServerMSDESQL Server CE
Services
Analysis (Data Mining)Analysis (OLAP)DTSIntegration ServicesNotification ServicesReporting Services
Programming
CLRConnectivitySQLXML
Other Technologies
ClusteringEnglish QueryFull-Text SearchReplicationService Broker
General
Data WarehousingPerformanceSecuritySetupSQL Server ToolsOther SQL Server Topics
DirectoryUser Groups
Related Topics
MS AccessOther DB ProductsMS Server Products.NET DevelopmentVB DevelopmentJava DevelopmentMore Topics ...

SQL Server Forum / General / Security / April 2005

Tip: Looking for answers? Try searching our database.

Inactive record

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Paul - 27 Apr 2005 15:54 GMT
Hi just wondering if there is a way to have one record in a table be read
only, were an application can not remove it and have all other records act
normally?  I am currently handling this in  .net code but would prefer to
have it built into the table.
thanks.
Signature

Paul G
Software engineer.

Jens Süßmeyer - 27 Apr 2005 16:16 GMT
No there is now row level security based on SQL Server 2000.

HTH, Jens Suessmeyer.

---
http://www.sqlserver2005.de
---

> Hi just wondering if there is a way to have one record in a table be read
> only, were an application can not remove it and have all other records act
> normally?  I am currently handling this in  .net code but would prefer to
> have it built into the table.
> thanks.
Jens Süßmeyer - 27 Apr 2005 16:25 GMT
Sorry, i mean : No there is no row level security based on SQL Server 2000.

> No there is now row level security based on SQL Server 2000.
>
[quoted text clipped - 10 lines]
>> have it built into the table.
>> thanks.
Paul - 27 Apr 2005 16:28 GMT
ok thanks for the information.

> No there is now row level security based on SQL Server 2000.
>
[quoted text clipped - 9 lines]
> > have it built into the table.
> > thanks.
Hugo Kornelis - 27 Apr 2005 22:55 GMT
>Hi just wondering if there is a way to have one record in a table be read
>only, were an application can not remove it and have all other records act
>normally?  I am currently handling this in  .net code but would prefer to
>have it built into the table.
>thanks.

Hi Paul,

You can use a trigger:

CREATE TRIGGER DontTouchThisRow
ON MyTable AFTER UPDATE, DELETE
AS
IF EXISTS (SELECT *
          FROM   deleted
          WHERE  KeyCol = 1)    -- Column to be protected
BEGIN
 RAISERROR ('Row 1 may not be changed or removed', 16, 1)
 ROLLBACK TRANSACTION
END
go

Best, Hugo
Signature


(Remove _NO_ and _SPAM_ to get my e-mail address)

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.