Custom Query Notifications

Oct 7, 2006

When I first saw SqlCacheDependancy and Query Notifications I was really stoked. I began using these features in ASP.NET and some of this caching really sped up my site. However, I noticed some of my queries and results were not cached. This led me on a looonnnnggggg search of the internet for anything related to these topics.

Anyway, the problem is that the queries are very limited (http://msdn2.microsoft.com/en-us/library/ms181122.aspx) in what they can contain, no count(*), no top, no order by, etc etc. I understand that the reason for this may be that the Query Notifications is using some of the Indexed Views infrastructure and therefore has the same limitations. That's fine and all but caching the results of these types of queries is still very useful for a front page of a site where you want the top ten users by number of postings etc and if you use the TOP N clause to limit it to the top 10 then you lose the built in caching functionality because this query doesn't work with Query Notifications and the cache expires immediately.

Is there a way to just get notifications when the tables involved in a query changes? I don't need the granular level of the rowsets involved I just want to be notified if my table has changed so I can refresh my cached objects.

I know there is an overload for the constructor of the SqlCacheDependency class which takes the database and table names as parameters. MSDN states that this is for Sql Server 7 and 2000 but would this also work in my scenerio? I know it wouldn't be auto-magical but if I can still get pushed notifications of changes instead of polling for notifications I would believe this to be a more efficient solution.

Query Notifications are fantastic but the query limitations make real world usage a pain, it's like have a nice red sports car but finding out you can only drive it whens it is raining and then you can only make right turns.

Regards

View 1 Replies


ADVERTISEMENT

The SQL Server Service Broker For The Current Database Is Not Enabled, And As A Result Query Notifications Are Not Supported. Please Enable The Service Broker For This Database If You Wish To Use Notifications.

Feb 16, 2008

Hello,          I receive this error  "The SQL Server Service Broker for the current database is not enabled, and as a result query notifications are not supported.  Please enable the Service Broker for this database if you wish to use notifications." I attach the database in Management Studio to query and enable the broker using the scrip below but to no avail. ALTER DATABASE DataName SET ENABLE_BROKER ‘''<<------successfulandSELECT is_broker_enabled FROM sys.databases WHERE name = 'Database name' ‘'''<<-------value is 1 Global.asax ...    Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)        System.Data.SqlClient.SqlDependency.Start(ConfigurationManager.ConnectionStrings("dataConnectionString1").ConnectionString)    End Sub...Web.config ...    <connectionStrings>        <add name="dataConnectionString1" connectionString="Data Source=.SQLEXPRESS;AttachDbFilename=|DataDirectory|jbp_data.mdf;Integrated Security=True;User Instance=True"         providerName="System.Data.SqlClient" />        <add name="ASPNETDBConnectionString" connectionString="Data Source=.SQLEXPRESS;AttachDbFilename=|DataDirectory|ASPNETDB.MDF;Integrated Security=True;User Instance=True"         providerName="System.Data.SqlClient" />    </connectionStrings>... Hope you could help.  cheers,imperialx 

View 1 Replies View Related

Query Notifications In SQL Express?

Feb 25, 2007

I am finding conflicting information about enabling query notifications for SQL Express. One book says it can be done and shows an example but most places on MSDN claim it requires the Service Broker. I am using Management Studio for SQL Express which does not show the Service Broker while an installation with SQL Server 2005 Dev Edition does show the Service Broker.This is all very confusing. I want to be able to develop locally with SQL Express with Query Notifications and later deploy to a server which is more capable. Previously I have read that only real difference between SQL Server 2005 and SQL Express is a 2gb memory limit.How would I go about setting up Query Notifications for SQL Express? Where would I find such documentation on MSDN?   

View 1 Replies View Related

SQL 2012 :: Query Notifications For More Than Just Cache?

Jan 13, 2015

All the recommendations I see from Microsoft docs is to limit the use of Query Notifications (QNs) to notifying connected clients when changes to mostly-static reference or configuration data occur, and to keep the number of overall query forms in play and connected clients to a minimum. Any way regarding a more integral use of QNs and Service Broker from a web app to notify n-web servers (farm) of an update to data that could be updated concurrently and quite frequently, or with a system where the technique is used extensively with lots of different query forms?

View 0 Replies View Related

Query Notifications/ Service Broker Problem

Sep 11, 2006

Hey , I encountered a problem using SqlDependency and notification services.
I€™ve created a database with tools from c# Express 2005 and attached it to the sql server express 2005. And it turned out that €˜dependency_OnChange€™ in my application is triggered each time I execute the command.ExecuteReader(); and it shouldn€™t, because the command is just the select statement of columns and rows for which I wait to be modified.

SqlDependency dependency = new SqlDependency(command);
dependency.OnChange += new OnChangeEventHandler(dependency_OnChange);
command.ExecuteReader();//when the program gets here dependency_OnChange is called


So I Used the example from here :
http://msdn2.microsoft.com/en-us/library/a52dhwx7.aspx

and with AdventureWorks it behaves as it should , but when I change the connection string and select statement in the example to work with MyDatabase, the problem appears again.
So there is something wrong with MyDatabase ?

The select statement I used was €œselect Name, Pass from Users where Name like €˜L%€™€?;
So theoretically this should work but it does not and I end up in an infinite loop with
dependency_OnChange called cyclically €¦

I€™d be grateful for any advice !

View 1 Replies View Related

Query Notifications Filling Up The Transmission Queue

Jul 19, 2007



I have a web application that sets up a query notification on a queue. Normal operation works fine, but for some reason the queue being monitored disables occasionally (even with the transaction, error message, and end dialog message) pattern set up as described in Remus' blog post. When the queue disables, everything goes insane and the transmission queue, left unchecked, fills up the transmission queue with hundreds of thousands of PostQueryNotification messages. Am I doing something wrong? What should I do to mitigate this because it IS possible that the queue might disable sometimes, and I don't want drive space eaten up on a low-end SQL Express machine, if it does. Also - second question - where is the transmission queue storing all these messages? TempDB?

View 10 Replies View Related

SqlCacheDependency Query Notifications -- Correct Permisisons -non Dbo Owner Account

Jul 5, 2007

 
Hi,
I am using SqlCacheDependency with the query notifications of SQL server 2005.
It is working nicely with the dbo.owner account but not with my web user account,
so I am thinking something is wrong with the permissions. 
After searching around, it seems that the main permissions to enable are these:
GRANT SUBSCRIBE QUERY NOTIFICATIONS TO theAccount
GRANT RECEIVE ON QueryNotificationErrorsQueue TO theAccount
GRANT REFERENCES on CONTRACT::[http://schemas.microsoft.com/SQL/Notifications/PostQueryNotification] to theAccount
GRANT SELECT TO theAccount.
 
I enabled these and it still doesn't work.  When I change my table, my cache is not getting invalidations.
Does anyone know what could be going on?  Or perhaps how can I trace the problem and get some clues?
thanks so much,
-tajmahal
 
 

 
 
 
 
 
 
 
 
 
 
 
 
 

View 3 Replies View Related

Displaying Custom Properties For Custom Transformation In Custom UI

Mar 8, 2007

Hi,

I am creating a custom transformation component, and a custom user interface for that component.

In
my custom UI, I want to show the custom properties, and allow users to
edit these properties similar to how the advanced editor shows the
properties.

I know in my UI I need to create a "Property Grid".
In
the properties of this grid, I can select the object I want to display
data for, however, the only objects that appear are the objects that I
have already created within this UI, and not the actual component
object with the custom properties.

How do I go about getting the properties for my transformation component listed in this property grid?

I am writing in C#.

View 5 Replies View Related

Select Query For Custom Paging

May 23, 2007

 Hi,I
am working on this select query for a report on website users. The
resulting rows will be displayed in a datagrid with custom paging. I
want to fetch 100 rows each time. This is the simplified query,
@currpage is passed as a parameter. ________________________________________________________________________________DECLARE @table TABLE (rowid INT IDENTITY(1,1), userid INT)INSERT INTO @table (userid) SELECT userid FROM UsersSELECT T.rowid, T.userid, ISNULL(O.userid, 0)FROM @table TLEFT OUTER JOIN ( SELECT DISTINCT(userid) FROM orders)AS OON O.userid = T.useridAND T.rowid > ((@currpage-1) * 100) AND T.rowid <= (@currpage * 100)ORDER BY T.rowid________________________________________________________________________________If
I run this query it returns all the rows, not just the 100 rows
corresponding to the @currpage value. What am I doing wrong? (The
second table with left outer join is there as I need one field to
indicate whether the user has placed an order with us or not. If the
value is 0, the user has not placed any orders) Thanks. 

View 2 Replies View Related

Can I Add Query Field With Custom Calculation

Nov 20, 2007

i have 3 question :
1. CAN MY MICROSOFT ACCESS Database imported to sql server 2005 ?
2. can i add field for queries with custom calculation like field 1*fiedld 2. like access can do?
3. is that any wizard to do no 1 and 2?


thanks

View 2 Replies View Related

Can I Add Query Field With Custom Calculation

Nov 20, 2007

i have 3 question :
1. CAN MY MICROSOFT ACCESS Database imported to sql server 2005 ?
2. can i add field for queries with custom calculation like field 1*fiedld 2. like access can do?
3. is that any wizard to do no 1 and 2?


thanks

View 1 Replies View Related

Execute Query Within Custom Code

Apr 2, 2008

Hi,
Is it possible to connect to a database and fetch data from it from within custom code inside a report?
Appreciate any help.

Regards,
Asim.

View 4 Replies View Related

Query On Custom Source Component

May 10, 2006



Hi

in the acquireconnection method Using the below statment I can get a connection Object

oledbConnection = cmado.AcquireConnection(transaction) as OleDbConnection;

from the connection object I can get the connectionstring from the object by calling

oledbConnection.connectionstring() property which will have all the details like DataBase, UserName & other Inofrmation but there is no password Info.

How to get the password Information, I need that information since I will use that info to make OCI calls to fetch the data from the Oracle database in m,y custome source component.

any help is much appriciated

thanks in advance.

View 10 Replies View Related

Query Database From Custom Code

Dec 17, 2007

Hi experts,

I have a custom code that successfully query my database in SSRS 2005 report.
However, I am hard coding its connection string (in the custom code) and I want it to be able to use the same connection string as the ones that the report use. This information is available in my registry setting, but if it is possible, I want to avoid that, since I aim for a quite simple solution. If I am able to get the connection string details at the report level or from within the custom code, it would be great.

Anybody have a suggestion? Anything would be really appreciated.

Thanks

View 1 Replies View Related

Custom SiteMap - Search By Several Strings In One Query

Mar 4, 2008

I am building myself a datadriven menu control and I have got one table where I store all menu items as rows. On each row there is a column for roles, in this column I have added one or several roles as a string. Today I can retrieve all menu items (rows) for a requested role, but how can I retrieve menu items for two or more roles? I have each role inserted as rows in a temp table (@Role), if that makes it easier?DECLARE @Role TABLE (     role varchar(15)) SELECT SiteMap.Id, SiteMap.Title, SiteMap.UrlFROM SiteMapWHERE (CHARINDEX(@Roles, SiteMap.Roles) > 0 ) Regards, Sigurd

View 2 Replies View Related

Endless Query With Custom Function - DATEADD

Apr 11, 2015

I created a function to use in a View, works similar to DATEADD but only with my company's Business days Monday-Thursday.

I am running a query but it never ends to run.

This is the function:

USE [RA_dev]
GO
/****** Object: UserDefinedFunction [Production].[GBDATEADD] Script Date: 4/11/2015 5:58:19 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON

[Code] ...

This is how I am trying to use it in the View:

Production.GBDATEADD(Production.Schedule.START_DATE, Production.Operations_Data_Pool.MFG_DAY - 1) AS SCH_DATE

View 2 Replies View Related

Custom Code Database Query And Connectionstring

Jun 1, 2007

I have some custom code in my report <Code> element that I use to query a database. I have hardcoded the connectionstring in this code but I would like to use the same datasource that the report uses. Is there some report property that allows me to access this datasource?

View 11 Replies View Related

How To Protect From SQL Injection In ASP.NET And SQL 2005 For Custom Query Expression?

Oct 3, 2006

How to Protect From SQL Injection in ASP.NET and SQL 2005 for custom query expression?In my project, I allow user to custom query expression through UI, such asstring queryCondition=' sale>20 and sale <100'string queryCondition=' createDate>"10/10/2005"'string queryCondition='Fullname like "%Paul%" '...I construct SQL based the queryCondition string, such as string mysql='select * from mytable where '+queryConditionI know it's very dangerous because of SQL Injection, but it's very convenient for user to custom query expressionCould you tell me how to do? many thanks!

View 13 Replies View Related

T-SQL (SS2K8) :: Write Query To Get Steps In Custom Job That Have Not Completed?

Mar 11, 2014

I have the following:

create table testdata
(
StepName varchar(25)
,StepStatus char(25)
,EntryDate datetime)
insert testdata values ('Step1','Starting',getdate())
insert testdata values ('Step2','Starting',getdate())
insert testdata values ('Step3','Starting',getdate())
insert testdata values ('Step4','Starting',getdate())
insert testdata values ('Step1','Finished',getdate())
insert testdata values ('Step2','Finished',getdate())
insert testdata values ('Step3','Finished',getdate())

I need a query that will basically return Step 4 hasn't finished.

I have tried a few ways but can't get it to work...

View 5 Replies View Related

Expression Editor On Custom Properties On Custom Data Flow Component

Aug 14, 2007

Hi,

I've created a Custom Data Flow Component and added some Custom Properties.

I want the user to set the contents using an expression. I did some research and come up with the folowing:





Code Snippet
IDTSCustomProperty90 SourceTableProperty = ComponentMetaData.CustomPropertyCollection.New();
SourceTableProperty.ExpressionType = DTSCustomPropertyExpressionType.CPET_NOTIFY;
SourceTableProperty.Name = "SourceTable";






But it doesn't work, if I enter @[System:ackageName] in the field. It comes out "@[System:ackageName]" instead of the actual package name.

I'm also unable to find how I can tell the designer to show the Expression editor. I would like to see the elipses (...) next to my field.

Any help would be greatly appreciated!

Thank you

View 6 Replies View Related

Expression Issue With Custom Data Flow Component And Custom Property

Apr 2, 2007

Hi,



I'm trying to enable Expression for a custom property in my custom data flow component.

Here is the code I wrote to declare the custom property:



public override void ProvideComponentProperties()

{


ComponentMetaData.RuntimeConnectionCollection.RemoveAll();

RemoveAllInputsOutputsAndCustomProperties();



IDTSCustomProperty90 prop = ComponentMetaData.CustomPropertyCollection.New();

prop.Name = "MyProperty";

prop.Description = "My property description";

prop.Value = string.Empty;

prop.ExpressionType = DTSCustomPropertyExpressionType.CPET_NOTIFY;



...

}



In design mode, I can assign an expression to my custom property, but it get evaluated in design mode and not in runtime

Here is my expression (a file name based on a date contained in a user variable):



"DB" + (DT_WSTR, 4)YEAR( @[User::varCurrentDate] ) + RIGHT( "0" + (DT_WSTR, 2)MONTH( @[User::varCurrentDate] ), 2 ) + "\" + (DT_WSTR, 4)YEAR( @[User::varCurrentDate] ) + RIGHT( "0" + (DT_WSTR, 2)MONTH( @[User::varCurrentDate] ), 2 ) + ".VER"



@[User::varCurrentDate] is a DateTime variable and is assign to 0 at design time

So the expression is evaluated as: "DB189912189912.VER".



My package contains 2 data flow.

At runtime,

The first one is responsible to set a valid date in @[User::varCurrentDate] variable. (the date is 2007-01-15)

The second one contains my custom data flow component with my custom property that was set to an expression at design time



When my component get executed, my custom property value is still "DB189912189912.VER" and I expected "DB200701200701.VER"



Any idea ?



View 5 Replies View Related

Job Notifications

Sep 20, 2007

What is the best way to get notification for a sql server 2005 job that runs longer than certain time.

View 5 Replies View Related

Using Custom Query To Retrieve And Update Data From Sql Server In SharePoint

Apr 5, 2007

is it possible to make a custom query to fetch and update data from sql server 2005 in SharePoint designer

i make a new data source library and use a custom query to get data but don€™t know how to configure update custom command
can any buddy help me out

View 1 Replies View Related

SQL Server Notifications

Jan 8, 2004

Does anyone have any idea how I would go about creating an object that can be informed of any modifications to a SQL data base. i.e. a .NET object that can detect whenever a table is updated.
It is NOT possible to modify the database in anway, so I can't add triggers etc.

View 3 Replies View Related

NET SEND Notifications

Aug 26, 2002

Is there a way to send a net send notification to more than one user? I can send to one successfully. Thanks.

View 1 Replies View Related

Notifications - Not Working (help!)

Oct 14, 2004

I have set up notifications to be sent if a job fails. however, nothing is sent
If I go to Job History, I can see the yellow envelope under "notification" but I receive no email I have set up an Operator and can send email using "Send Email" but it doesn't work!

1. SQL Server - Management
2. SQL Server AGent
3. Go to Operators
4. I can set up a new operator by right-clicking "New Operator"
5. In Name, I have "John"
6. After "E-mail Name", i click in the 3 elipses, which brings up my address book in Outlook. I will select, let's say "John Smith"
7. When I click Test, it says "message was sent successfully" but I get no email
8. However, if I go to Outlook and send to "John SMith", it will send

View 1 Replies View Related

Mobile Notifications.

Apr 28, 2008

Hi

How to setup mobile notifications on jobs using SQL Server 2000. Aim is when a job fails I should receive SMS notification on my mobile phone.

Please show me web sites on this topic.

Please help.

Thanks & Regards


Raj.

View 1 Replies View Related

SMTP Notifications

Sep 24, 2007

Hi

How to Create SMTP Notifications using SQL Server 2000.

Thanks & Regards

-Raj

Raj.

View 13 Replies View Related

Email Notifications

Oct 4, 2007

Some packages I develop have a lot of steps, and some people like myself can go crazy with email notifications, depending on the graph, I sometimes add notifications (success/fail) at the component level, so I can know what happened to that SSIS package from my blackberry and immediately log into the VPN and fix the issue.

The only problem that I have with that is that sometimes, like right now, I see myself adding 6 "send mail tasks" to SSIS packages, one pass/fail for each component.

Basically, I was wondering if anyone had any ideas or suggestions, ideally I wish I could create one single send mail task that could be reused by other components on the package and just update the message/subject through expression and variables.

View 6 Replies View Related

SQL Agent Job Notifications

Oct 18, 2007

Does anyone know how to send SQL agent job failure notifications to more than one operator??

Thanks!

View 2 Replies View Related

Missing Notifications

Jan 19, 2006

Hello,

We are building a simple distributed application around the service broker where each queue is serviced from a windows service. We have a windows service running constantly as a "listener" on an event queue for each of what we call "request" queues. When a message is received by the request, the listener service instantiates a reader to process the request.

As we are in development, things get out of sync at times and the event queues sometimes stop getting the event notification message. I can correct this usually emptying the queues by receiving all messages from the "request" and "event" queues but sometimes it becomes necessary to drop and recreate the broker objects. Can someone tell me what are the fail points event_notification and what corrective actions are needed at these points?

For instance, if I see that a queue has a state of "Notified" in dm_broker_queue_monitors, I just do a receive to drain the appropriate queue. I have been unable to determine what state the service broker is in when I have to delete and recreate the event notification so I don't know what is causing it and how to programmatically determine when it is necessary to take this action. We would of course prefer not to get to this state but since it can happen during development, I would guess this can happen in production so I need to develop the recovery logic to detect and correct for this condition.



Jim

View 14 Replies View Related

Events &&amp; Notifications

Oct 25, 2007

Hi

I would like to know how I can get hold the text for a service and event notifications.
What I need is the ability to get hold of a list of the events I'm currently monitoring.

i.e.

Server or database level

I though I would be able to get hold of this in sys.server_event_notifications but it doesn't seem to have any data although my server level event notifcation service is running.

Any help?

TIA

View 1 Replies View Related

Multiple Notifications

May 29, 2007



I'm beginer with service brooker and i wandering if someone could help me to clarify what would be the proper usage of service broker for my current situation...



Suppose i have 3 tables: Customers, Orders and Providers. I would like my c# application to receive a notification for any data change on any of these tables. I know i could use my 3 tables in a SELECT statement for a global event notification but i need to know from wich table change occured.



I also though to create 3 separate event notification but i'm really not sure...



What is the best approch to acheive this??



Any help would be really appreciated







View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved