Читайте также:
|
|
<factEventAnalyzer>
<logging>
<logFolder path="D:\DiplomaProject\AnalyzingWorkFolder\log"/>
</logging>
<factMinerSettings>
<changeThreshold value="0.3"/>
<securities from="0" to="99999999"/>
<dates from="0" to="99999"/>
<spikeThreshold value="6"/>
<dateThreshold value = "3"/>
<filesForMl value="D:\DiplomaProject\FilesForML"/>
</factMinerSettings>
</factEventAnalyzer>
Приложение 3. Хранимые процедуры и табличные представления базы данных FactEventAnalysisDB
Usp_populateCoraxFactsTable
USE [FactEventAnalysisDB]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[usp_populateCoraxFactsTable]
@DateFrom int = 0,
@DateTo int = 999999999,
@SecIdFrom int = 0,
@SecIdTo int = 999999999,
@SecuritiesInserted int = 0 output,
@CoraxesInserted int = 0 output
AS
BEGIN
create table #Inserted
(
UniqueCoraxId int not null,
SecId int not null
)
insert into dbo.CoraxFactsTable
(
SecId,
UniqueCoraxId,
EffectiveDate,
ReportedDate,
EventType,
EventMajorType
)
output
inserted.UniqueCoraxId,
inserted.SecId
into #Inserted
SELECT
c.SecId as SecId,
c.UniqueCoraxId as UniqueCoraxid,
CAST(c.EffectiveDate as int) as EffectiveDate,
CAST(c.ReportedDate as int) as ReportedDate,
c.EventType as EventType,
c.EventMajorType as EventMajorType
from
dbo.CoraxesSource as c
where
c.SecId >= @SecIdFrom
and c.SecId <= @SecIdTo
and (
(c.ReportedDate>=@DateFrom
and c.ReportedDate<=@DateTo)
or
(c.EffectiveDate>=@DateFrom
and c.EffectiveDate<=@DateTo)
)
select @CoraxesInserted = COUNT(*)
from
#Inserted
select
@SecuritiesInserted = COUNT(t.SecId)
from
(select distinct SecId from #Inserted) as t
END
GO
Usp_clearFactsTables
USE [FactEventAnalysisDB]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[usp_clearFactsTables]
@DateFrom int = 0,
@DateTo int = 999999999,
@SecIdFrom int = 0,
@SecIdTo int = 999999999,
@IsPrices bit = 0,
@IsCorax bit = 0,
@IsSpike bit = 0
AS
BEGIN
IF (@IsPrices = 1)
BEGIN
delete from
dbo.PriceFactsTable
where
SecId >= @SecIdFrom
and SecId <= @SecIdTo
and (
(DateStart >= @DateFrom
and DateStart <=@DateTo)
or
(DateEnd <= @DateTo
and DateEnd >= @DateFrom))
END
IF (@IsSpike = 1)
BEGIN
delete from
dbo.SpikeFactsTable
where
SecId >= @SecIdFrom
and SecId <= @SecIdTo
and [Date] >= @DateFrom
and [Date] <= @DateTo
END
IF (@IsCorax = 1)
BEGIN
delete from
dbo.CoraxFactsTable
where
SecId >= @SecIdFrom
and SecId <= @SecIdTo
and (
(ReportedDate>=@DateFrom
and ReportedDate<=@DateTo)
or
(EffectiveDate>=@DateFrom
and EffectiveDate<=@DateTo))
END
END
GO
Дата добавления: 2015-11-16; просмотров: 53 | Нарушение авторских прав
<== предыдущая страница | | | следующая страница ==> |
Список использованных ресурсов | | | Приложение 4. Система классификации |