Re: Difference between tsql and libsybdb

"James K. Lowden" <[email protected]>
Newsgroups gmane.comp.db.tds.freetds
Message-ID <[email protected]>
On Tue, 25 Sep 2012 18:15:38 +0200
Alberto Pulvirenti <[email protected]> wrote:

> > Session properties aren't set by dbopen().  They're set via
> > T-SQL's SET command.  Read up on that, and on @@options.  (Nowadays
> > there's a function to query session properties individually, not
> > just as a bit mask.)
> 
> This last paragraph I didn't fully understand.

What may not be clear is that the problem you're seeing doesn't
manifest itself when you first open the connection.  It shows up when
you issue that particular query.  A simple query like 

	SELECT 1 as 'one'

will not fail.  But one that requires e.g. CONCAT_NULL_YIELDS_NULL
will.  

CONCAT_NULL_YIELDS_NULL is a session property.  Session properties in a
T-SQL session are set using the T-SQL SET command, cf.
http://msdn.microsoft.com/en-us/library/ms190356.aspx.  Among the many
arcane things affected by session properties are the ability to create
indexed views and the ability to *use* an existing index of an indexed
view, cf. "Requirements for the CREATE INDEX Statement" at
http://msdn.microsoft.com/en-us/library/aa933148(v=SQL.80).aspx.

> In any case, I suppose that I can issue such a SET command only once
> the DBPROCESS is properly initialized after dbopen().

English is a little ambiguous here.  You can issue any number of SET
commands for the duration of the session, just as any query, after
dbopen() and before dbclose().  

HTH.  

--jkl
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.