last day (15 days later) » 

5:46 PM
1
A: SQLDependency subscription not registered and Query Notification message has Source Statement and Info Set Options

Dan Guzman - SQL Server MVPCheck the connection SET options reported in Profiler to verify the following SET options are effective: ANSI_NULLS ON ANSI_PADDING ON ANSI_WARNINGS ON CONCAT_NULL_YIELDS_NULL ON QUOTED_IDENTIFIER ON NUMERIC_ROUNDABORT OFF ARITHABORT ON Note that ARITHABORT must be set ON explicitly after the ...

 
I executed DBCC Useroptions on SSMS and resultset shows that everything you mentioned are already turned on: 'textsize 2147483647', 'language us_english', 'dateformat mdy', 'datefirst 7', 'lock_timeout -1', 'quoted_identifier SET', 'arithabort SET', 'ansi_null_dflt_on SET', 'ansi_warnings SET', 'ansi_padding SET', 'ansi_nulls SET', 'concat_null_yields_null SET', 'isolation level read committed'
 
Can you try Profiler instead of SSMS?
 
what events i have to trace in profiler to get this resultsets?
 
Audit login and ExistingConnection will include the SET options.
 
After checking in profiler, every options are set as you mentioned except ArithAbort which is off.
 
5:46 PM
Then your database is probably in SQL Server 2000 compatibility mode. You will need to either explicitly issue a SET ARITHABORT ON or change the compatibility to a later one. I suggest you change the compatibility unless you have a specific reason not to. It may just be the setting is an artifact of an upgrade long ago.
 
Hello Dan
i am not clear what you are explaining to me. i am using SQL server 2008 R2 (10.50)
How can i explicitly set arithabort on?
 
Execute statement SET ARITHABORT ON;" immediately after connecting in your code.
You can modify the database compatibility level to SQL Server 2008 with a one-time script: "ALTER DATABASE MYDatabase SET COMPATIBILITY_LEVEL = 100;" so that you don't need to change the SET option in code.
 
Hello Dan, we have compatibility level set explicitly to 2000 for some reason, i dont think i can change that
and as i explained from my post i am connecting to sql server thru ado.net code with passed query
i dont have option to SET ARITHABORT On; there
if i use a stored procedure i could have done that before executing proc
Also when i traced the sql server error log file i get the following error whenever i start the application which tries to subscribe for query notificcation:
Service broker needs to access the master key in the database 'CRM', Error code: 26. The master key has to exist and the service master key encryption is required.
i explicity created master key by using command: Create Master key encryption by passsword='password'. but still no luck
:(
i am struggling to get this query notification working for quiet a few days, but no luck so far :(
if you help me thru this issue, you are a life saver for me
 
6:12 PM
If you change the database compatibility, problem solved.
 
okay, for testing i will change it, but still i can change back the compatibility to 2000 right?
 
Yes, it's each to change back if needed.
 
oh my god! i cant believe its working now :) :)
thanks a ton!
also please tell me trick what to do to get it working still with compatibility level to 2000????
where to use SET ARITHABORT ON ?
i mean when and where
 
Here's an untested example:
public List<Customer> GetLeadUpdates(SqlDependency dependency)
{
using (var connection = new SqlConnection(ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString))
{
connection.Open();
using (var command = new SqlCommand("SET ARITHABORT ON;", connection))
{
command.ExecuteNonQuery();
dependency.AddCommandDependency(command);
command.CommandText = "SELECT id, name, salary FROM [dbo].[CustomerTest]";

var reader = command.ExecuteReader();
var list = new List<Customer>();
while (reader.Read())
 
6:31 PM
Thanks a lot Dan. you are God to me today. :) Have a great day
 
Glad I was able to help.
 

last day (15 days later) »