Re: Multiple update statements

Robert Gonzalez <[email protected]>
Newsgroups gmane.comp.db.tds.freetds
Message-ID <[email protected]>
The way that is written I think you would get a failure. Just a thought,
because there are no SQL terminators in that, so to the server it looks like
one long query string. But I could be wrong about that.

On Fri, Oct 9, 2009 at 1:36 PM, Strumyla, Marius <[email protected]>wrote:

> I'm maintaining someone else's code. Application is written in PHP with
> MS SQL database. Driver installed is FreeTDS 0.64. Platform Solaris 10
> x86.
>
> I came across this query:
> mssql_query("UPDATE user_project SET membership=43 WHERE project=49 AND
> usernum=2UPDATE user_project SET membership=0 WHERE project=49 AND
> usernum=9UPDATE user_project SET membership=0 WHERE project=49 AND
> usernum=10UPDATE user_project SET membership=0 WHERE project=49 AND
> usernum=12UPDATE user_project SET membership=0 WHERE project=49 AND
> usernum=14UPDATE user_project SET membership=0 WHERE project=49 AND
> usernum=15UPDATE user_project SET membership=0 WHERE project=49 AND
> usernum=16")
>
> What is interesting is that records that don't exist are inserted :) If
> I had an empty user_project table, after the execution of the above
> query I would have 7 new records in user_project.
>
> I would like to know whether this is expected and documented somewhere.
>
> Thanks
> _______________________________________________
> FreeTDS mailing list
> [email protected]
> http://lists.ibiblio.org/mailman/listinfo/freetds
>



-- 

Robert Gonzalez
http://www.robert-gonzalez.com
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.