Setting NO COUNT default on a connection only(not the entire datab

  • Thread starter Thread starter bryme
  • Start date Start date
B

bryme

Is there a way to specify in a connection string that NOCOUNT should be set
ON for a specific SQL Server connection?

We have some databases that will need to be consolidated onto a sinlge
database instance. The majority of the databases require NO COUNT to be set
OFF, while there are also custom developed databases that require that NO
COUNT be set ON. We would rather not have to separate the databases, but
want to know short of updating the code and re-testing for the custom
databases, if there would be parameters that could be set in the database
connection string for the applications. We are using ADO and ADO.Net and the
OLEDB drivers for SQL.

I know there is the default connection setting, but that applies the setting
for the entire database server. We'd like to be able to connect specific to
a database and specify that setting. In Query Analyzer/Management Studio,
that is easily accomplished via either the Advanced Execution setting or
executing the SET statement to change the setting, so surmised there must be
something we can add to our connection strings to accomplish this.

Any ideas?
 
Nope. SET values cannot be set in a ConnectionString.
In the case of ADO.NET I suggest use of the SqlClient namespace--not OleDb.
It's faster, lighter and less problematic.

--
__________________________________________________________________________
William R. Vaughn
President and Founder Beta V Corporation
Author, Mentor, Dad, Grandpa
Microsoft MVP
http://betav.com http://betav.com/blog/billva
(425) 556-9205 (Pacific time)
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
____________________________________________________________________________________________
 
No, not really. SET statements can only be set via a TSQL script.

--
__________________________________________________________________________
William R. Vaughn
President and Founder Beta V Corporation
Author, Mentor, Dad, Grandpa
Microsoft MVP
(425) 556-9205 (Pacific time)
Hitchhiker’s Guide to Visual Studio and SQL Server (7th Edition)
____________________________________________________________________________________________
 
Back
Top