显示标签为“sample”的博文。显示所有博文
显示标签为“sample”的博文。显示所有博文

2012年3月27日星期二

Flight Sample Debate

Hi All,

I found the Flight Sample Description at http://msdn2.microsoft.com/en-us/library/ms160946(d=ide).aspx .

I installed the file SQLServerSamples.msi which is in C:\Program

Files\Microsoft SQL Server\90\Tools\Samples by default.

I followed the steps strictly.

Every thing was OK except:

- I didn't have any response in the Notifications folder which by

default resides in C:\Program Files\Microsoft SQL Server\90\Samples\Notification

Services\Flight

- I didn't understand what happened exactly

So:

- What are the probable causes of not getting a result?

- I want some documentation about what happens in the example.

Thanks in advance,

Bishoy

Anything in the Event Viewer?

Try turning on Verbose logging to see if that helps point you in the right direction.

|||

1- That all what is found in Event Viewer:

Event Type: Information
Event Source: Service Control Manager
Event

Category: None
Event ID: 7035
Date: 8/11/2006
Time: 6:13:43

PM
User: BISHOYLAPTOP\Bishoy
Computer: BISHOYLAPTOP
Description:
The

NS$FlightInstance service was successfully sent a start control.

For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.

> but still there is nothing appeared in the Notifications Folder

2- What is Verbose login

3- I want documentation source about that Flight Sample.

Thank you.

Bishoy

|||

I found where the error was:

There should be one strong name key for both the

AddSubscribers and AddSubscription projects.

The signing for both projects is ..\..\..\SampleKey.snk which I could never

make myself.

Now I have the following questions or inquires:

1- I want some documentations about what happened in that example.

2- How to sign a project to present key in above folder like

..\..\..\SampleKey.snk (because browse button copy the key to the project

folder)?

3- What is the output meaning in the Notifications folder which is

FileNotifications.txt file?

Many Thanks and Best Regards.

Bishoy

|||

Hi Bishoy -

Rather than continuing with two parallel conversations, I've posted replies to the NewsGroup.

http://groups.google.com/group/microsoft.public.sqlserver.notificationsvcs/browse_frm/thread/24e8f2b998118394/013718ab4d063ff3?hl=en#013718ab4d063ff3

HTH...

Joe

2012年3月21日星期三

Flagging duplicate records help!

Hi all, hoping you can help me.
Here's some sample data:
DATE PHONE DUPE
1/27/2006 8888888888 0
2/22/2006 8888888888 0
2/25/2006 8888888888 0
3/30/2006 8888888888 0
2/10/2006 7777777777 0
2/10/2006 7777777777 0
3/18/2006 7777777777 0
etc...
What i'd like to do is make DUPE = 1 if less than 30 days has passed since
he last called, so in the above sample it should look like this after:
DATE PHONE DUPE
1/27/2006 8888888888 0
2/22/2006 8888888888 1
2/25/2006 8888888888 1
3/30/2006 8888888888 0
2/10/2006 7777777777 0
2/10/2006 7777777777 1
3/18/2006 7777777777 0
etc...
There are hundreds of thousands of records in the table and i'm currently
using a proc that uses cursors and it's taking way too long and is very
resource heavy.
Thanks in advance to anyone that can helpDo you plan on updating DUPE for all the records with the same phone
number or only the only the most recent entry...with DUPE. Because if
the person called 3 years ago, and then yesterday and then today, will
all 3 have DUPE updated, because of todays call.In this case you are
updating records which could be so far down in the table and this may
be unneccesary'
Have you considered making a view which shows all distinct phone
numbers which were called in the last 30 days and the last time it was
called ...MAX(calldate) ...then using a JOIN to get occurences after
the date in the view.and update the record based on that.|||Are you saving time part also?
create table t1 (
[date] datetime,
phone varchar(10),
dupe tinyint
)
go
insert into t1 values('2006-01-27 00:00:00.000', '8888888888', 0)
insert into t1 values('2006-02-22 00:00:00.000', '8888888888', 0)
insert into t1 values('2006-02-25 00:00:00.000', '8888888888', 0)
insert into t1 values('2006-03-30 00:00:00.000', '8888888888', 0)
insert into t1 values('2006-02-10 00:00:00.000', '7777777777', 0)
insert into t1 values('2006-02-10 01:00:00.000', '7777777777', 0) <--
trick to diff calls
insert into t1 values('2006-03-18 00:00:00.000', '7777777777', 0)
go
update t1
set dupe = 1
where [date] < dateadd(day, 30, (select min(t2.[date]) from t1 as t2 where
t2.phone = t1.phone and t2.[date] < t1.[date]))
go
select
*
from
t1
order by
phone, [date]
go
AMB
"ttrottier" wrote:

> Hi all, hoping you can help me.
> Here's some sample data:
> DATE PHONE DUPE
> 1/27/2006 8888888888 0
> 2/22/2006 8888888888 0
> 2/25/2006 8888888888 0
> 3/30/2006 8888888888 0
> 2/10/2006 7777777777 0
> 2/10/2006 7777777777 0
> 3/18/2006 7777777777 0
> etc...
> What i'd like to do is make DUPE = 1 if less than 30 days has passed since
> he last called, so in the above sample it should look like this after:
> DATE PHONE DUPE
> 1/27/2006 8888888888 0
> 2/22/2006 8888888888 1
> 2/25/2006 8888888888 1
> 3/30/2006 8888888888 0
> 2/10/2006 7777777777 0
> 2/10/2006 7777777777 1
> 3/18/2006 7777777777 0
> etc...
>
> There are hundreds of thousands of records in the table and i'm currently
> using a proc that uses cursors and it's taking way too long and is very
> resource heavy.
> Thanks in advance to anyone that can help|||UPDATE Whatever
SET DUPE = 1
WHERE EXISTS
(select * from Whatever as D
where Whatever.PHONE = D.PHONE
and Whatever.Date < D.Date)
This would be helped a lot by an index on (PHONE, DATE).
Roy Harvey
Beacon Falls, CT
On Wed, 29 Mar 2006 08:30:02 -0800, ttrottier
<ttrottier@.discussions.microsoft.com> wrote:

>Hi all, hoping you can help me.
>Here's some sample data:
>DATE PHONE DUPE
>1/27/2006 8888888888 0
>2/22/2006 8888888888 0
>2/25/2006 8888888888 0
>3/30/2006 8888888888 0
>2/10/2006 7777777777 0
>2/10/2006 7777777777 0
>3/18/2006 7777777777 0
>etc...
>What i'd like to do is make DUPE = 1 if less than 30 days has passed since
>he last called, so in the above sample it should look like this after:
>DATE PHONE DUPE
>1/27/2006 8888888888 0
>2/22/2006 8888888888 1
>2/25/2006 8888888888 1
>3/30/2006 8888888888 0
>2/10/2006 7777777777 0
>2/10/2006 7777777777 1
>3/18/2006 7777777777 0
>etc...
>
>There are hundreds of thousands of records in the table and i'm currently
>using a proc that uses cursors and it's taking way too long and is very
>resource heavy.
>Thanks in advance to anyone that can help|||Please post DDL, so that people do not have to guess what the keys,
constraints, Declarative Referential Integrity, data types, etc. in
your schema are. Sample data is also a good idea, along with clear
specifications. It is very hard to debug code when you do not let us
see it.
Is this what you meant?
CREATE TABLE PhoneLog
(call_date DATETIME NOT NULL,
phone_nbr CHAR(10) NOT NULL,
dup_flag INTEGER DEFAULT 0 NOT NULL
CHECK (dupe_flag IN (0,1)),
PRIMARY KEY (call_date, phone_nbr));
Try another approach -- relational, not computatinal! Adjust the
following table for 30 business days rather than calendar days if you
need to.
CREATE TABLE ReportRanges30days
(start_date DATETIME NOT NULL,
end_date DATETIME NOT NULL,
CHECK (start_date < end_date),
PRIMARY KEY (start_date, end_date));
Ten years will fit into main storage so now use a join whch can get the
covering index:
UPDATE PhoneLog
SET dup_flag
= CASE WHEN
EXISTS (SELECT *
FROM ReportRanges30days
WHERE call_date
BETWEEN start_date AND end_date)
THEN 1 ELSE 0 END
You might also put this into a VIEW and avoid updating all the time.|||Hi and thanks for the reply.. but this isn't quite what i need,
if you run the following code, you'll see that the last record
is not flagged as a duplicate, but it should be since it was
within 30 days of the previous record.. any ideas?
Thanks very much.
drop table t1
create table t1 (
[date] datetime,
phone varchar(10),
dupe tinyint
)
go
insert into t1 values('2005-08-30 13:39:00', '8888888888', 0)
insert into t1 values('2005-08-30 13:41:00', '8888888888', 0)
insert into t1 values('2005-12-21 10:03:00', '8888888888', 0)
insert into t1 values('2005-12-21 10:05:00', '8888888888', 0)
go
update t1
set dupe = 1
where [date] < dateadd(day, 30, (select min(t2.[date]) from t1
as t2 where
t2.phone = t1.phone and t2.[date] < t1.[date]))
go
select * from t1 order by phone, [date] go
---
Posted with NewsLeecher v2.0 Beta 5
* Binary Usenet Leeching Made Easy
* http://www.newsleecher.com/?usenet
---|||On Fri, 31 Mar 2006 15:10:35 GMT, ttrottier wrote:

>Hi and thanks for the reply.. but this isn't quite what i need,
>if you run the following code, you'll see that the last record
>is not flagged as a duplicate, but it should be since it was
>within 30 days of the previous record.. any ideas?
Hi ttrottier,
UPDATE t1
SET dupe = 1
WHERE EXISTS
(SELECT *
FROM t1 AS d
WHERE t1.Date > d.Date
AND t1.Date <= DATEADD(day, 30, d.Date))
Hugo Kornelis, SQL Server MVP