Subject | RE: [Firebird-general] Silly SQL Server... |
---|---|
Author | Svein Erling Tysvær |
Post date | 2009-10-06T14:08:04Z |
Not even read-only databases are completely bullet proof against user stupidity. I would expect it to be possible to write a stored procedure in Firebird that could come up with results similar to what you report SQL server does:
for select FieldA from D into :MyVar do
begin
If (MyVar is not null) then
begin
Update M
Set FieldA = :MyVar
Where...
end
end;
Set
-----Original Message-----
From: Firebird-general@yahoogroups.com [mailto:Firebird-general@yahoogroups.com] On Behalf Of Kjell Rilbe
Sent: 6. oktober 2009 15:54
To: Firebird-general@yahoogroups.com
Subject: Re: [Firebird-general] Silly SQL Server...
Alexandre Benson Smith wrote:
other ways to do it or if FB has other constructs that could suffer
similar mixing as SQL Server.
Somehow it seems typical of a Microsoft product to do strange unexpected
things without telling anyone... And I though other FB enthusiasts like
me might find this example amusing. :-)
Kjell
for select FieldA from D into :MyVar do
begin
If (MyVar is not null) then
begin
Update M
Set FieldA = :MyVar
Where...
end
end;
Set
-----Original Message-----
From: Firebird-general@yahoogroups.com [mailto:Firebird-general@yahoogroups.com] On Behalf Of Kjell Rilbe
Sent: 6. oktober 2009 15:54
To: Firebird-general@yahoogroups.com
Subject: Re: [Firebird-general] Silly SQL Server...
Alexandre Benson Smith wrote:
> Kjell Rilbe wrote:Thank you - I knew about that syntax for FB. Just wondered if there are
> > Now, as far as I know FB doesn't support this update ... from syntax,
> > but is there any other way that FB could end up mixing data from
> > multiple records in this subtle way instead of throwing an exception?
> >
> > Kjell
> >
>
> Since you will need a sub-query like
>
> update
> M
> set
> M.FieldA = (select FieldA from D where ...),
> M.FieldB = (select FieldB from D where ...)
>
> you would get "multiple records" error, this kind of update requires a
> single row returned
>
> So I don't think you could get such mixing with FB.
other ways to do it or if FB has other constructs that could suffer
similar mixing as SQL Server.
Somehow it seems typical of a Microsoft product to do strange unexpected
things without telling anyone... And I though other FB enthusiasts like
me might find this example amusing. :-)
Kjell