freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
Re: Using SQL Query Analyser to replicate functionality
- From: Michael Peppler <mpeppler AT peppler.org>
- To: "TDS Development Group" <freetds AT franklin.oit.unc.edu>
- Subject: Re: Using SQL Query Analyser to replicate functionality
- Date: Tue, 8 Jan 2002 16:50:50 -0800
Caveat - I'm looking at this from the Sybase perspective - there may
be differences with MS-SQL that I'm not aware of....
James Cameron writes:
> A small query extracted from the analysis appears below. It apparently
> increments an object number in a table according to a type code, and
> then SELECTs it again to read it back, all in one transaction.
>
> - while I know what "begin tran" and "commit tran" do, what does "go"
> do?
"go" is the command to send a query to the serve in isql/sqsh...
> - what does the "exec sp_executesql N'" sequence mean?
sp_executesql probably executes a dynamic piece of SQL. I doesn't
quite make sense in this context, though.
> - why are the literal strings segregated from the command?
I'm guessing that it's because the literal strings are passed to
sp_executesql to get executed. It's possible that the N'....'N bit
gets preprocessed.
> - while not relevant to this example, if I don't see a "with (nolock)"
> clause in a query, does this prove it is not done?
Not sure what you mean here.
> Now, the complex transaction ... marks a customer case as accepted by a
> customer support specialist ... much more is done here, but it raises
> more questions:
>
> - is it possible to get FreeTDS to operate in this way in which multiple
> SQL commands are issued in a transaction and 'return' statements in the
> SQL prevent execution of following commands?
Not on a single connection. It would be possible to create a deadlock
via two connections from the same client - however the server will
kill one of the requests.
> - can the value of @@error after execution of this be exposed to a PHP
> script?
Dunno - it should be available via the normal OpenClient error
handling (i.e. server callback)
BTW - all those sp_executesql are IMHO a sign of lazyness. The user
should create the appropriate procs for the operations instead of
passing dynamic SQL that way.
Michael
--
Michael Peppler - Data Migrations Inc. - http://www.mbay.net/~mpeppler
mpeppler AT peppler.org - mpeppler AT mbay.net
International Sybase User Group - http://www.isug.com
-
Using SQL Query Analyser to replicate functionality,
James Cameron, 01/08/2002
- <Possible follow-up(s)>
- Re: Using SQL Query Analyser to replicate functionality, Michael Peppler, 01/08/2002
- Re: Using SQL Query Analyser to replicate functionality, Steve Langasek, 01/08/2002
- Re: Using SQL Query Analyser to replicate functionality, James K. Lowden, 01/08/2002
Archive powered by MHonArc 2.6.24.