all groups > sql server notification services > april 2007 >
You're in the

sql server notification services

group:

Multi-Valued Subscription Parameters


Multi-Valued Subscription Parameters Todd C
4/13/2007 5:30:02 AM
sql server notification services:
Hello All

I am setting up a Subscription class with two parameters; let's call them P1
and P2. However, the subscribers would like to have multiple combinations of
these two parameters. In other words, if they want 4 possible values for P1
and 3 possible values for P2, then they would need to submit 12 (4 P1 times 3
P2) unique combinations, each one a new subscription.

What I am looking for is a way to have just one Subscription record with
each Parameter being a string of comma separated values so that P1 would be
'AAA, BBB, CCC, DDD' and P2 would be '11, 22, 33' etc.

I have played around with a stored procedure that would parse the two
parameters into two temp tables then do a FULL OUTER JOIN to bring them back
together with the correct number of rows. This SP works but I am having
trouble joining its results back into the SELECT criteria for the
subscription.

I don't think my way could handle multiple subscriptions being processed in
the same batch.

Is there an ELEGANT way to parse out these strings in NS?

Thanks in advance
--
Re: Multi-Valued Subscription Parameters Joe Webb
4/16/2007 6:35:56 AM
[quoted text, click to view]


See if either of these posts help:

http://groups.google.com/group/microsoft.public.sqlserver.notificationsvcs/browse_thread/thread/87871744decee742/a76995956e9bcf76?lnk=gst&q=optional+subscription&rnum=1#a76995956e9bcf76

http://groups.google.com/group/microsoft.public.sqlserver.notificationsvcs/browse_thread/thread/1937323c4b8361fd/92bb28d6a17e2139?lnk=gst&q=optional+subscription&rnum=2#92bb28d6a17e2139

HTH...

--
Joe Webb
SQL Server MVP
http://www.sqlns.com



Re: Multi-Valued Subscription Parameters Todd C
4/16/2007 8:04:06 AM
Joe: Neither of those links is close to my issue.
Sorry.

See my original post. I can't explain it any better.
--
Todd Chittenden


[quoted text, click to view]
Re: Multi-Valued Subscription Parameters Todd C
4/17/2007 5:10:02 AM
Joe:

The "Subscription Management Application", at this point, is me and a couple
of stored procedures I run from SSMS. The Subscribers have no direct
interface YET.

The goal is to make it easier for SOMEBODY (that sombody being me now and
the users later on) if they want to edit their parameters. Managing one
record of Subscription info per user seems easier than managing 15 or 20.

I guess what I am really looking for is to have the Subscription matching
logic dynamically parse out the Parameter values at "Match Time".

This is my very "UN-ELEGANT" theory for a possible solution:
Have a cursor step through each Subscription row and parse the two
parameters into two respective temp tables, then do a FULL OUTER JOIN of
those two temp tables, and insert the rows into a third table along with the
SubscriberID, DeviceName, and Locale. The cursor would need to clear out the
temp tables before it moved on to the next Subscription row.

In the end, the 'match logic' would look at the final (third) table which
would have a fully normalized set of subscription data in it. After all the
subscription matching is done, the third table would need to be cleaned out
to get ready for the next quantum run.

Very brutish but I think it would work. Looking for any suggestions on a
better way to do this.

--
Todd Chittenden



[quoted text, click to view]
Re: Multi-Valued Subscription Parameters Joe Webb
4/17/2007 6:28:13 AM
[quoted text, click to view]


The links I sent were for consideration if you wanted to broaden your
subscription from 2 to 12, with some of them being optional. After
re-reading your OP, perhaps I misunderstood what you're trying to
accomplish.

Is the intent to make it easier for the subscriber? If so, what about
having your subscription management application pass in the delimited
string, parsing it, and then creating the 12 subscriptions.

If that's not the reasoning, can you elaborate on it?

--
Joe Webb
SQL Server MVP
http://www.sqlns.com



Re: Multi-Valued Subscription Parameters Joe Webb
4/18/2007 12:00:00 AM
[quoted text, click to view]


I would definitely try to dissuade you from that implementation. As clever
and creative as it is, performance would likely be very, very bad.
Cursors, as I'm sure you already know, are resource intensive and should
be used only as a last resort. Using them in the match rule could cause
some unintended results.

If you are managing subscription with scripts (currently), and later with
a subscription management application, I would suggest that you keep the
12-20 subscriptions per user so that SSNS can do its thing well. You can
write scripts (and later on the SMA) to allow you to pass in the delimited
string, XML doc, whatever, to the scripts and have them parse out the
subscriptions.

Just my two cents...

HTH...

Joe


--
Joe Webb
SQL Server MVP
http://www.sqlns.com



Re: Multi-Valued Subscription Parameters Todd C
4/18/2007 5:42:01 AM
Like I said, my proposed solution would be very brutish and unelegant.

I think I'll look for another way to handle this one ...

Thanks
--
Todd C

[quoted text, click to view]
Re: Multi-Valued Subscription Parameters Joe Webb
4/19/2007 12:00:00 AM
[quoted text, click to view]

Well, I wouldn't be that harsh; it is very creative.

Feel free to post more proposed solutions.


--
Joe Webb
SQL Server MVP
http://www.sqlns.com



AddThis Social Bookmark Button