October 2, 2003 at 6:24 am
Are there any way in t-sql to make a recorset read only. The users should not be able to edit the result
-Lars
Please only reply to this newsgroup. All mails would be bounced back.
-Lars
Please only reply to this newsgroup. All mails would be bounced back.
October 2, 2003 at 7:20 am
This has nothing to do with T-SQL.
By default, any SELECT statement returns a recordset that is 'read only'. Only if you are using a cursor, you can change the data.
It is the client stuff like ADO that makes it a recordset with browse and update/delete functionality. Most client libraries support some sort of 'read only' property for the Recordset object.
A cursor is made read-only by using the FOR READ ONLY clause in your cursor definition.
If possible, you can also use the built-in security features of SQL server by only granting SELECT and revoking UPDATE and DELETE permissions on the tables.
Edited by - NPeeters on 10/02/2003 07:20:20 AM
October 3, 2003 at 1:41 am
Perhaps I wasn't clear enough. I was wondering if there are any overview of when SQL EM sets the recordset to read only.
Ex: SELECT DISTINCT TblName FROM TABLE1.
If I run this in EM, I'm not able to edit the fields, but when I'm not using the distinct - I can edit the fields. Are there any overview when a recordset is read only.
I know of these now:
Disitnct
Union
Pass through
SUM
AVG
- Lars
-Lars
Please only reply to this newsgroup. All mails would be bounced back.
October 3, 2003 at 1:52 am
If you want people to use EM then give them only read rights. Look up SQL server security in BOL
To do it for one view only do select * from table with(nolock), although they will still be able to write directly to the source table if they have EM
Keith Henry
DBA/Developer/BI Manager
Keith Henry
October 3, 2003 at 4:12 am
The "read only" flag as you want to implement is application specific. i.e. in you enduser app (VB, Delphi, C#...) you have to define you recordset or data grid as read only.
If you want to implement a general way let's do like Keith suggested. Don't grant any insert/update/delete rights.
I personnaly do not give access to EM to my users.
EM is as the name says: Enterprise Manager and not Application Query Tool
Bye
Gabor
Bye
Gabor
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply