Re: Stored procs and DB-aware components possible at all?

From: Arthur Hoornweg (antispam.hoornweg_at_casema.nl.net)
Date: 03/08/05


Date: Tue, 08 Mar 2005 09:44:47 +0100

Vitali Kalinin schreef:

> What do you mean by this? If you have defined yours views with INSTEAD OF
> triggers then just make sure that views are created WITH VIEW_METADATA. For
> details look at BOL.

I've already been through all that two years ago, but I
encountered some really hair-pulling issues that made me
give up on updateable views.

Problem 1 has to do with "WITH VIEW_METADATA" : it makes
ADO property "update criteria=adcriteriakey" stop working.
Ado insists on locating the records that it updates by
comparing all fields with their previous values, not just
the primary key field. In my specific case, that is very
undesirable because it is a multi-user database and different
users need to be able to edit different fields in the same
records simultaneously.
I tried to circumvent this by creating an updateable view with
a primary key but it just wouldn't work. So I had to give
up on "with view_metadata".

Problem 2: I tried to let the view call a UDF (user-defined-
function, that's a special kind of stored procedure) that
implements the row-based security, but unfortunately MSSQL
failed to optimize that call, the function was executed for
every row in the resultset of the query that defined the
view. Performance became dreadfully slow if the database
size exceeded a few 100,000 records. That was unacceptable.
So I had to give up on views that call UDF's/stored procs.

Problem 3: I also tried to realize the updateable view using an
INNER JOIN instead of a UDF. That initially worked very well,
but it turned out to be impossible to delete records (this is
documented in BOL, BTW). So I had to give up on INNER JOIN.

Problem 4:
I tried using "WHERE...IN" instead of INNER JOIN. This was
extremely promising at first, but it turns out that MS SQL
Server 2000 has a nasty bug here: you simply can't use
GUID's in the "WHERE" clause. All my primary keys are
GUIDS, so I had to give up on this.

After losing a week of precious time on this issue I decided
that updateable views don't deliver what they promise and
completely gave up on them.

Then somebody in this newsgroup (I believe it was Brian) mentioned
"application roles" to me, and that solved my problem, at the
expense of having to lock out all other software applications
from my database.

-- 
Arthur Hoornweg
(In order to reply per e-mail, please just remove the ".net"
  from my e-mail address. Leave the rest of the address intact
  including the "antispam" part. I had to take this measure to
  counteract unsollicited mail.)


Relevant Pages

  • Re: Primary Key Count
    ... that make up the primary key for the table. ... the query you would run in SQL Server 2005: ... inner join sys.index_columns as sic on ... It's a SQL 2005 database on both ends. ...
    (microsoft.public.dotnet.languages.csharp)
  • Updateable query!
    ... Some of our staff work from home and normally log in to our database ... Cowboy (Gregory A. Beamer) - MVP wrote: ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Creating a key on the Input form
    ... including BOTH fields in the Primary Key OR by using an Autonumber for ... A PO# takes priority over a BOL#. ... > saying that there is a problem with the field relationship if you go ... > Private Sub PO__LostFocus ...
    (microsoft.public.access.modulesdaovba)
  • Re: DAL or BOL? Can someone clarify?
    ... I would consider this to be code that should be in the BOL? ... The same if i was deleting records in the database, ... multiple database writes and executes them in an explicit transaction, ... ExecuteInTransaction method in my DAL. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Detachng database thats supposedly being replicated
    ... I am familiar with BOL, but just didn't find what I was looking for in it ... database is being replicated even though I see no sign that it actually is. ... "Randall Arnold" wrote: ... I have a SQL Server 2000 database that I need to temporarily detach ...
    (microsoft.public.sqlserver.replication)