Re: Turning of ANSI Padding in a ado.net connection string



Mark Talbot @ Rhetorik (MarkTalbotRhetorik@xxxxxxxxxxxxxxxxxxxxxxxxx)
writes:
I have a load of stored procedures to do some string analasis on our
database which are drasticaly faster in SQL Server 2005 Management
Studio than they are from ado.net. We have tracked this problem to the
fact that ansi padding is turned off by the database and manegment
studio, but the ado.net connector has it switch on by default. This is
creating an order of magnatude in performance degradtion and I cant find
any information on how to adjust the SET options that a connection
creates.

I doubt that your analysis is correct.

First of all, the database option ANSI_PADDING, only has an effect if
it's ON. Then it overrides a connection that comes in with OFF, which
mainly happens with legacy clients.

Second, ANSI_PADDING is by default ON in Mgmt Studio, even if there are
some scripting facilities that may end SET ANSI_PADDING ON at the end
for some reason. (This is a bug in my opinion.)

Third, the setting of ANSI_PADDING is saved per table column. Thus, at
run-time, ANSI_PADDING only affects table variables and temp tables.


--
Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
.



Relevant Pages

  • Re: My Book is Incomplete Regarding SQL Commands ;-(
    ... Hitchhiker's Guide to Visual Studio and SQL Server ... Create a Connection object and pass in a ConnectionString to ... manage the database table you reference. ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: (Newbie)Application Roles
    ... level: the database itself. ... SQL Server accommodates these needs through the use of application ... the user's connection through a specific application. ... the connection permanently loses all permissions applied to ...
    (microsoft.public.sqlserver.security)
  • Re: Help! Set up Windows Group to access application
    ... The connection string for a trusted connection is: ... --add login as database user ... SQL Server MVP ... If you have troubles with finding your ways in Crystal Reports, ...
    (microsoft.public.sqlserver.security)
  • Re: My Book is Incomplete Regarding SQL Commands ;-(
    ... Visual Studio but not to VS 2003. ... Create a Connection object and pass in a ConnectionString to address ... manage the database table you reference. ... Yep, my latest book can help too, but mostly if you're targeting SQL Server ...
    (microsoft.public.dotnet.framework.adonet)
  • RE: Logging in in background
    ... wold take all kinds of modifictions as I'd need to be checking that each SQL ... my database and all have connection strings associated with them. ... I suspect that there is also an issue on the SQL Server side as I keep ...
    (microsoft.public.access.modulesdaovba)