Skip to Content.
Sympa Menu

freetds - RE: [freetds] MSSQL syntax flavors

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Lowden, James K" <LowdenJK AT bernstein.com>
  • To: 'FreeTDS Development Group' <freetds AT lists.ibiblio.org>
  • Subject: RE: [freetds] MSSQL syntax flavors
  • Date: Thu, 3 Jul 2003 11:25:40 -0400

> From: Andrew Pimlott [mailto:andrew AT pimlott.net]
> Sent: July 3, 2003 9:03 AM
>
> On Thu, Jul 03, 2003 at 08:30:00AM +0200, Michael Peppler wrote:
> >
> > Interesting - maybe the MSSQL query tool silently removes the
> > semi-colon.
>
> I doubt it's just that: The line above is part of a long statement,
> so the query tool would have to be parsing the whole statement.
> Plus, I found other discrepancies (since sending the message), for
> example with sqsh I get complaints of errors that the MSSQL tool
> ignores, like non-existent columns (in this respect, sqsh works
> better!). Also, I had to change "GO" to "go" in one place. It
> really seems like I'm using a whole (but subtly) different mode.

The differences you're describing are in the application, not the protocol.
If you are using TDS 7.0 with sqsh, then the server really can't distinguish
between sqsh and any Microsoft ODBC tool.

For instance, GO/go isn't sent to the server; it's processed by the tool and
serves as a terminator, separating batches of SQL:

$ isql -E -c foo
1> select 1; select 2
2> go
3> foo

-----------
1

(1 row affected)
go
-----------
2

(1 row affected)

Note Microsoft's isql uses TDS 4.2. It passes the semicolon to the server
(which ignores it), passes "go" as a column label for the second select
statement, and sends the batch on "foo".

How do I know the semicolon is passed? The same query works with tsql!

> > and sqsh will often interpret the
> > ; as meaning "go" - i.e. send the current SQL batch to the server).
>
> You're right that removing the semicolon makes everyone happy.

"man sqsh" is your friend here. sqsh has quite a lot of built-in semicolon
interpretation.

I think the moral of the story is that different tools are different. We
quite often get questions here along the lines of "it works in [tool] but
not in FreeTDS". Many times it turns out to be a flaw in FreeTDS, and
sometimes it's just an idiosyncrasy of [tool]. ;-)

--jkl
-----------------------------------------
The information contained in this transmission may contain privileged and
confidential information and is intended only for the use of the person(s)
named above. If you are not the intended recipient, or an employee or agent
responsible for delivering this message to the intended recipient, any
review, dissemination, distribution or duplication of this communication is
strictly prohibited. If you are not the intended recipient, please contact
the sender immediately by reply e-mail and destroy all copies of the original
message. Please note that we do not accept account orders and/or instructions
by e-mail, and therefore will not be responsible for carrying out such orders
and/or instructions.






Archive powered by MHonArc 2.6.24.

Top of Page