Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 661991
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T23:19:44+00:00 2026-05-13T23:19:44+00:00

I have a SqlDependency set up using the following query: string sql = "SELECT

  • 0

I have a SqlDependency set up using the following query:

string sql = "SELECT dbo.Case.CMRID, dbo.Case.SolutionID, dbo.Case.CreateDT, dbo.Case.ModifyDT "
+ "FROM dbo.Case "
+ "WHERE dbo.Case.ModifyDT > @LastExecutionDateTime";

Executing this query causes the OnChanged event to fire continuously with a type of Invalid and Source of Statement. Which upon further research I found is what happens when your query breaks rules that are the same as the rules for indexed views since that is what this notification mechanism is based on.

Checking the Special Considerations Using Query Notifications (ADO.NET) I do not see any rules I am breaking with this statement.

Modifying the statement to

string sql = "SELECT dbo.Case.CMRID, dbo.Case.SolutionID, dbo.Case.CreateDT, dbo.Case.ModifyDT "
+ "FROM dbo.Case";

Does work correctly. The OnChanged event only fires when appropriate, and has the correct type set.

So, how can I only return records with a modify date since my last execution of the statement?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T23:19:45+00:00Added an answer on May 13, 2026 at 11:19 pm

    What type is ModifyDT?

    The ADO.Net reference for QN is incomplete, the complete list is in the SQL reference at Creating a Query for Notification. The latter also lists the following:

    The statement must not have comparison
    or expression based on double/real
    data types.

    Another problem may be the cast from string to datetime that occurs in your query, which may be considered non-deterministic (which is a criteria listed by both ADO.Net and SQL spec). Try using a typed parameter instead: WHERE ModifyDT > @lastDateTime and pass in a parameter of type DateTime.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My application connects to several SQL Server instances (Using SMO and ADO.net), these connections
Have set up a small website for a client however contact form submissions are
Working on someone else's code where they've instituted a SQL Dependency event (SQL 2008).
I am trying to use EF4 with the SQLDependency object with not much luck.
Have been writing the shell script such as : #! /bin/bash `sqlplus -s <username>/<passwd>@dbname`
Have same challenge as this guy: How to copy dependencies to gae war/WEB-INF/lib Applying
have a wierd issue. for the life of me can't trace this back (its
Have a slight problem. Trying to post XML to a server. To do this,
I am trying to figure out how to monitor more than one table with
What are the key differences between these and when should they be used? My

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.