The information in this article applies to:
SUMMARYThis article discusses changes in behavior that are introduced when you upgrade from Microsoft SQL Server version 6.0 and its associated Microsoft ODBC drivers to SQL Server 6.5 and its associated Microsoft driver. If you are using non-Microsoft ODBC drivers, consult the documentation from your driver vendor. MORE INFORMATION
When a version 2.65.0201 or later ODBC driver connects to a 6.50 or later
SQL Server, it sets the following options with SQL Server:
The net effect of setting these options is that when the 2.65.0201 or later drivers are connected with a version 6.50 or later server, they will operate with three ANSI options turned on that were not turned on in earlier environments. The settings that will cause changes in behavior from those observed in the SQL Server 6.0 drivers are listed below. Additional information on their effects can be found in the SQL Server 6.5 "Books Online" section "What's New In 6.5," Part 4, What's New for Transact-SQL, Statements and Functions, Set Statement. Also note that these behaviors will not show up in DB-library based applications such as ISQL/w, Enterprise Manager, isql, and so forth, unless the user has also issued the settings listed above. SET ANSI_NULLS ON With this setting active, SQL statements cannot use the = or <> operators to compare for nulls; they must use IS NULL or IS NOT NULL. For example, in the following ISQL/w script:
the first select returns one row with colb = NULL, the second select returns no rows. This can also affect commands in stored procedures if their WHERE clauses attempt = or <> comparisons using parameters passed in with null values. See the What's New section in the SQL Server 6.5 "Books Online" for further information. SET ANSI_PADDING ON When enabled, the ANSI_PADDING causes varchar and varbinary values to be padded with spaces or nulls. It also affects fixed-length datatypes such as char or int. If the user specifies that columns of fixed-length datatypes (char, int, tinyint, smallint) can be NULL, ANSI_PADDING causes these columns to be padded in the event of a null value. If a table is created while ANSI_PADDING is enabled, the table column will exhibit the padding behavior. Disabling ANSI_PADDING has no effect on existing columns. SET ANSI_WARNINGS ON This setting will cause the Microsoft ODBC driver to generate messages in new conditions. One condition is that if an aggregate function encounters nulls it will generate a warning. For example, the following command referencing the table created above:
will return SQL_SUCCESS_WITH_INFO and a call to SQLError will return:
Another example is that an insert or update that attempts to put in a value whose length is larger than that allowed by the column will fail, whereas with ANSI_WARNINGS set off, the operation would go in after truncating the data. For example, with the TestNull table defined above and the 6.5 driver, the following:
will return SQL_ERROR, and call to SQLError until it returns SQL_NO_DATA_FOUND will return:
The 2.65.0240 driver that comes with SQL Server 6.5 Service Pack 2 adds the ability to control these ANSI settings. With this driver, you have several options for controlling these settings:
Keywords : kbinterop kbsetup ODBC SSrvInst |
Last Reviewed: March 25, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |