TOUCHED CHIRU'S HAND , FELT WARM BLOO...   Independent houses near kukatpally | Apartments in Pragathi Nagar | AndhraVaani.com | Log Out | Topics | Search
Register | Edit Profile

Bewarse TalkArchivesCine Talk - Reviews, Gossips, Insider Info etc.Archive through December 12, 2004 � TOUCHED CHIRU'S HAND , FELT WARM BLOOD UNDERNEATH Previous Next

Author Message
Top of pagePrevious messageNext messageBottom of pageLink to this message

Tifosi
Vooriki Bewarse
Username: Tifosi

Post Number: 2647
Registered: 03-2004
Posted From: 61.95.134.18
Posted on Thursday, December 09, 2004 - 9:11 pm:Edit PostDelete PostView Post/Check IP

oh my madness and a half
Top of pagePrevious messageNext messageBottom of pageLink to this message

Huberta
Pilla Bewarse
Username: Huberta

Post Number: 22
Registered: 12-2004
Posted From: 198.11.23.28
Posted on Thursday, December 09, 2004 - 12:00 pm:Edit PostDelete PostView Post/Check IP

oh my mad
Top of pagePrevious messageNext messageBottom of pageLink to this message

Evadravadu
Pilla Bewarse
Username: Evadravadu

Post Number: 120
Registered: 09-2004
Posted From: 65.115.93.118
Posted on Thursday, December 09, 2004 - 11:58 am:Edit PostDelete PostView Post/Check IP

naaakippudu motham ardham ayyipoindi..
Top of pagePrevious messageNext messageBottom of pageLink to this message

Musicfan
Vooriki Bewarse
Username: Musicfan

Post Number: 3158
Registered: 05-2004
Posted From: 134.244.170.168
Posted on Thursday, December 09, 2004 - 10:39 am:Edit PostDelete PostView Post/Check IP

KC mama enti aa language? C&P tappu chesavaa enti
Top of pagePrevious messageNext messageBottom of pageLink to this message

Musicfan
Vooriki Bewarse
Username: Musicfan

Post Number: 3157
Registered: 05-2004
Posted From: 134.244.170.168
Posted on Thursday, December 09, 2004 - 10:38 am:Edit PostDelete PostView Post/Check IP

Balayya123 mama

>>vunna mental gallatone sattunte ee kotta vinta gaallu entra baboo

itta navviste office lo vintaga choostunnaru...
Top of pagePrevious messageNext messageBottom of pageLink to this message

Apsrtc
Pilla Bewarse
Username: Apsrtc

Post Number: 194
Registered: 12-2004
Posted From: 141.218.211.103
Posted on Thursday, December 09, 2004 - 10:32 am:Edit PostDelete PostView Post/Check IP

lol...good.
Top of pagePrevious messageNext messageBottom of pageLink to this message

Nag_rocks
Bewarse ke Bewarse!
Username: Nag_rocks

Post Number: 7265
Registered: 03-2004
Posted From: 131.96.3.17
Posted on Thursday, December 09, 2004 - 7:41 am:Edit PostDelete PostView Post/Check IP

eti KC mama adi anta?
Top of pagePrevious messageNext messageBottom of pageLink to this message

Godfather
Bewarse ke Bewarse!
Username: Godfather

Post Number: 14635
Registered: 03-2004
Posted From: 80.63.180.90
Posted on Thursday, December 09, 2004 - 2:52 am:Edit PostDelete PostView Post/Check IP

>>>>vunna mental gallatone sattunte ee kotta vinta gaallu entra baboo
//andari fans aa leka only chiru fansaa??

yada raja tada praja!!
Top of pagePrevious messageNext messageBottom of pageLink to this message

Kingchoudary
Desanike Pedda Bewarse
Username: Kingchoudary

Post Number: 6630
Registered: 03-2004
Posted From: 210.212.245.241
Posted on Thursday, December 09, 2004 - 2:50 am:Edit PostDelete PostView Post/Check IP

ALTER DATABASE "IntelliDB" SET SINGLE_USER
go


-------------------------------Begin IxTablesUpgrade.sql------------------------------- ---
CREATE TABLE [dbo].[IX_ViewLocks] (
[ViewLockID] [bigint] IDENTITY (1, 1) NOT NULL ,
[ViewID] [bigint] NOT NULL ,
[Type] [varchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[Status] [varchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[CreationDate] [datetime] NOT NULL ,
[LastUpdateDate] [datetime] NOT NULL ,
[LockedBy] [bigint] NOT NULL ,
[MessageLockID] [bigint] NOT NULL ,
[MessageID] [bigint] NOT NULL ,
[LockType] [varchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[IX_Clients] (
[IX_ClientID] [bigint] NOT NULL ,
[IX_Name] [varchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[IX_Type] [varchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[IX_Status] [varchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[IX_CreationDate] [datetime] NOT NULL ,
[IX_LasstUpdateDate] [datetime] NOT NULL
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[IX_ConceptExpressions] (
[IX_ConceptExpressionID] [bigint] IDENTITY (1, 1) NOT NULL ,
[IX_ConceptID] [bigint] NOT NULL ,
[IX_Operand1] [bigint] NOT NULL ,
[IX_Operand2] [bigint] NOT NULL ,
[IX_Operand3] [bigint] NOT NULL ,
[IX_Operator] [varchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[IX_Data] [varchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[IX_Effect] [varchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[IX_Group] [varchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[IX_Type] [varchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[IX_Importance] [int] NOT NULL ,
[IX_Order] [int] NOT NULL ,
[IX_Status] [varchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[IX_CreationDate] [datetime] NOT NULL ,
[IX_LastUpdateDate] [datetime] NOT NULL ,
[IX_Name] [varchar] (400) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[IX_Description] [varchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[IX_OntologyID] [bigint] NOT NULL ,
[IX_ContextID] [bigint] NOT NULL ,
[IX_DisplayName] [varchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[IX_SortName] [varchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[IX_Control] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[IX_Operand1Extensions] [varchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[IX_Operand2Extensions] [varchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[IX_Operand3Extensions] [varchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO

CREATE TABLE [dbo].[IX_Concepts] (
[IX_ConceptID] [bigint] IDENTITY (1, 1) NOT NULL ,
[IX_Name] [nvarchar] (400) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[IX_Type] [varchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[IX_Importance] [int] NOT NULL ,
[IX_Description] [varchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[IX_Status] [varchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[IX_CreationDate] [datetime] NOT NULL ,
[IX_LastUpdateDate] [datetime] NOT NULL ,
[IX_CreatedByCode] [varchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[IX_Code] [varchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[IX_ContextID] [bigint] NOT NULL
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[IX_ConcurrentUse] (
[IX_ConcurrentUseID] [bigint] IDENTITY(1,1) NOT NULL ,
[IX_TimeSlot] [bigint] NOT NULL ,
[IX_UserID] [bigint] NOT NULL ,
[IX_Date] [datetime] NOT NULL ,
[IX_Status] [varchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[IX_Code] [varchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[IX_CreationDate] [datetime] NOT NULL ,
[IX_LastUpdateDate] [datetime] NOT NULL,
[IX_GUID] [varchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[IX_SizeKB] [int] NOT NULL ,
[IX_IPAddress] [varchar](500) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[IX_DocumentConcepts] (
[IX_DocumentConceptID] [bigint] IDENTITY (1, 1) NOT NULL ,
[IX_DocumentID] [bigint] NOT NULL ,
[IX_ParagraphNumber] [int] NOT NULL ,
[IX_Code] [bigint] NOT NULL ,
[IX_NumberOfHits] [int] NOT NULL ,
[IX_Importance] [int] NOT NULL ,
[IX_FolderConceptID] [bigint] NOT NULL ,
[IX_Type] [varchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[IX_Status] [varchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[IX_CreationDate] [datetime] NOT NULL ,
[IX_LastUpdateDate] [datetime] NOT NULL ,
[IX_Ranking] [int] NOT NULL ,
[IX_TemporalDate] [datetime] NOT NULL ,
[IX_ClosestMatch] [int] NOT NULL
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[IX_DocumentFolders] (
[IX_DocumentFolderID] [bigint] IDENTITY (1, 1) NOT NULL ,
[IX_DocumentID] [bigint] NOT NULL ,
[IX_Status] [varchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[IX_FolderID] [bigint] NOT NULL ,
[IX_Type] [varchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[IX_CreationDate] [datetime] NOT NULL ,
[IX_LastUpdateDate] [datetime] NOT NULL ,
[IX_DisplayCode] [varchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[IX_FolderScore] [bigint] NOT NULL ,
[IX_TemporalDate] [datetime] NOT NULL
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[IX_DocumentKeywords] (
[IX_DocumentKeywordID] [bigint] IDENTITY (1, 1) NOT NULL ,
[IX_DocumentID] [bigint] NOT NULL ,
[IX_NumberOfHits] [int] NOT NULL ,
[IX_Type] [varchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[IX_Status] [varchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[IX_CreationDate] [datetime] NOT NULL ,
[IX_LastUpdateDate] [datetime] NOT NULL ,
[IX_ConceptID] [bigint] NOT NULL ,
[IX_Importance] [int] NOT NULL ,
[IX_Sense] [bigint] NOT NULL
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[IX_DocumentWordOrders] (
[IX_DocumentWordOrderID] [bigint] IDENTITY (1, 1) NOT NULL ,
[IX_WordOrder] [bigint] NOT NULL ,
[IX_DocumentKeywordID] [bigint] NOT NULL ,
[IX_Type] [varchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[IX_Status] [varchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[IX_CreationDate] [datetime] NOT NULL ,
[IX_LastUpdateDate] [datetime] NOT NULL ,
[IX_SentenceNumber] [int] NOT NULL ,
[IX_SentencePosition] [int] NOT NULL ,
[IX_ParagraphNumber] [int] NOT NULL ,
[IX_PageNumber] [int] NOT NULL
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[IX_Documents] (
[IX_DocumentID] [bigint] IDENTITY (1, 1) NOT NULL ,
[IX_Name] [varchar] (400) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[IX_Path] [varchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[IX_NumberOfWords] [int] NOT NULL ,
[IX_Type] [varchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[IX_Importance] [int] NOT NULL ,
[IX_CreationDate] [datetime] NOT NULL ,
[IX_LastUpdateDate] [datetime] NOT NULL ,
[IX_Status] [varchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[IX_Description] [varchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[IX_SizeKB] [int] NOT NULL ,
[IX_LastAccessedDate] [datetime] NOT NULL ,
[IX_Size] [int] NOT NULL ,
[IX_Checksum] [bigint] NOT NULL ,
[IX_CompressedIndex] [binary] (500) NOT NULL ,
[IX_EventURL] [varchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[IX_EventConcept] [int] NOT NULL ,
[IX_VersionNumber] [int] NOT NULL
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[IX_FolderConcepts] (
[IX_FolderConceptID] [bigint] IDENTITY (1, 1) NOT NULL ,
[IX_NumberOfHits] [bigint] NOT NULL ,
[IX_Importance] [bigint] NOT NULL ,
[IX_Name] [varchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[IX_NumberOfDocuments] [int] NOT NULL ,
[IX_Type] [varchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[IX_FolderID] [bigint] NOT NULL ,
[IX_Valid] [varchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[IX_VersionNumber] [int] NOT NULL ,
[IX_Active] [varchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[IX_ConceptID] [bigint] NOT NULL ,
[IX_Status] [varchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[IX_CreationDate] [datetime] NOT NULL ,
[IX_LastUpdateDate] [datetime] NOT NULL ,
[IX_Ranking] [int] NOT NULL ,
[IX_ClosestMatch] [int] NOT NULL ,
[IX_Processed] [int] NOT NULL ,
[IX_LastAccessedDate] [datetime] NOT NULL ,
[IX_NeedsProcessing] [varchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[IX_Folders] (
[IX_FolderID] [bigint] IDENTITY (1, 1) NOT NULL ,
[IX_ViewID] [bigint] NOT NULL ,
[IX_DocumentCount] [int] NOT NULL ,
[IX_TotalImportance] [int] NOT NULL ,
[IX_TotalWords] [int] NOT NULL ,
[IX_VersionNumber] [int] NOT NULL ,
[IX_Type] [varchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[IX_ParentFolderID] [bigint] NOT NULL ,
[IX_Status] [varchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[IX_CreationDate] [datetime] NOT NULL ,
[IX_LastUpdateDate] [datetime] NOT NULL ,
[IX_Name] [varchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[IX_Description] [varchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[IX_Comments] [varchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[IX_ScoreSize] [int] NOT NULL ,
[IX_CompressedArchive] [binary] (500) NULL ,
[IX_SnapshotTime] [int] NULL ,
[IX_EventURL] [varchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[IX_EventConcept] [int] NOT NULL ,
[IX_Importance] [int] NOT NULL
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[IX_Messages] (
[IX_MessageID] [bigint] IDENTITY (1, 1) NOT NULL ,
[IX_Data] [char] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[IX_ViewID] [bigint] NOT NULL ,
[IX_UserID] [bigint] NOT NULL ,
[IX_Status] [varchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[IX_Code] [varchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[IX_CreationDate] [datetime] NOT NULL ,
[IX_LastUpdatedDate] [datetime] NOT NULL
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[IX_ProjectConcepts] (
[IX_ProjectConceptID] [bigint] IDENTITY (1, 1) NOT NULL ,
[IX_ProjectID] [bigint] NOT NULL ,
[IX_Name] [varchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[IX_Type] [varchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[IX_ConceptID] [bigint] NOT NULL ,
[IX_Status] [varchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[IX_CreationDate] [datetime] NOT NULL ,
[IX_LastUpdateDate] [datetime] NOT NULL
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[IX_Projects] (
[IX_ProjectID] [bigint] IDENTITY (1, 1) NOT NULL ,
[IX_Name] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[IX_ClientID] [bigint] NOT NULL ,
[IX_Type] [varchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[IX_Status] [varchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[IX_CreationDate] [datetime] NOT NULL ,
[IX_LastUpdateDate] [datetime] NOT NULL
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[IX_QueueMessages] (
[IX_Id] [bigint] IDENTITY (1, 1) Constraint IX_QueueMessages_IX_Id_U_C_IDX Primary Key NOT NULL ,
[IX_ParentId] [bigint] NOT NULL,
[IX_CreationDate] [datetime] NOT NULL ,
[IX_Data] [text] NOT NULL,
[IX_Type] [varchar] (2) NOT NULL,
[IX_UserId] [bigint] NOT NULL ,
[IX_ProjectId] [bigint] NOT NULL,
[IX_Name] [varchar] (500) NOT NULL,
[IX_Priority] [tinyint] NOT NULL ,
[IX_PriorityType] [tinyint] NOT NULL ,
[IX_Component] [varchar] (5) NOT NULL,
[IX_Status] [varchar] (2) NOT NULL,
[IX_LastUpdated] [datetime] NOT NULL,
[IX_TotalTasks] int NOT NULL,
[IX_TasksRemaining] int NOT NULL,
[IX_Queue] [varchar] (2) NOT NULL,
[IX_LastOwner] [varchar] (260) NOT NULL,
[IX_Revision] [varchar] (20) NOT NULL
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[IX_UserDocumentEvents] (
[IX_UserDocumentEvents] [bigint] IDENTITY (1, 1) NOT NULL ,
[IX_UserEventID] [bigint] NOT NULL ,
[IX_DocumentID] [bigint] NOT NULL ,
[IX_Type] [varchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[IX_Status] [varchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[IX_CreationDate] [datetime] NOT NULL ,
[IX_LastUpdateDate] [datetime] NOT NULL
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[IX_UserViews] (
[IX_UserViewID] [bigint] IDENTITY (1, 1) NOT NULL ,
[IX_UserID] [bigint] NOT NULL ,
[IX_ViewID] [bigint] NOT NULL ,
[IX_Type] [varchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[IX_Status] [varchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[IX_CreationDate] [datetime] NOT NULL ,
[IX_LastUpdateDate] [datetime] NOT NULL
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[IX_Users] (
[IX_UserID] [bigint] IDENTITY (1, 1) NOT NULL ,
[IX_Password] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[IX_Type] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[IX_Status] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[IX_CreationDate] [datetime] NOT NULL ,
[IX_LastUpdateDate] [datetime] NOT NULL ,
[IX_LastAccessDate] [datetime] NOT NULL ,
[IX_EmailAddress] [varchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[IX_FirstName] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[IX_LastName] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[IX_MiddleInitial] [varchar] (5) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[IX_CountryID] [bigint] NOT NULL ,
[IX_ZipCode] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[IX_AgeGroupID] [int] NOT NULL ,
[IX_PasswordQuestion] [varchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[IX_PasswordAnswer] [varchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[IX_GroupName] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[IX_UserProfileID] [bigint] NOT NULL ,
[IX_DefaultDirectory] [varchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[IX_GroupAdmin] [varchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO

CREATE TABLE [dbo].[IX_ViewConcepts] (
[IX_ViewConceptID] [bigint] IDENTITY (1, 1) NOT NULL ,
[IX_ViewID] [bigint] NOT NULL ,
[IX_ConceptID] [bigint] NOT NULL ,
[IX_Type] [varchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[IX_Status] [varchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[IX_CreationDate] [datetime] NOT NULL ,
[IX_LastUpdateDate] [datetime] NOT NULL ,
[IX_ReplacementID] [bigint] NOT NULL ,
[IX_Importance] [int] NOT NULL ,
[IX_SenseID] [bigint] NOT NULL ,
[IX_SenseStrength] [int] NOT NULL
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[IX_Views] (
[IX_ViewID] [bigint] IDENTITY (1, 1) NOT NULL ,
[IX_Name] [varchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[IX_ProjectID] [bigint] NOT NULL ,
[IX_Type] [varchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[IX_Status] [varchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[IX_CreationDate] [datetime] NOT NULL ,
[IX_LastUpdateDate] [datetime] NOT NULL
) ON [PRIMARY]
GO

ALTER TABLE [dbo].[IX_ViewLocks] WITH NOCHECK ADD
CONSTRAINT [PK_IX_ViewLocks] PRIMARY KEY CLUSTERED
(
[ViewLockID]
) ON [PRIMARY]
GO

ALTER TABLE [dbo].[IX_Clients] WITH NOCHECK ADD
CONSTRAINT [PK_IX_Clients] PRIMARY KEY CLUSTERED
(
[IX_ClientID]
) ON [PRIMARY]
GO

ALTER TABLE [dbo].[IX_ConceptExpressions] WITH NOCHECK ADD
CONSTRAINT [PK_IX_ConceptExpressions] PRIMARY KEY CLUSTERED
(
[IX_ConceptExpressionID]
) ON [PRIMARY]
GO

ALTER TABLE [dbo].[IX_Concepts] WITH NOCHECK ADD
CONSTRAINT [PK_IX_Concepts] PRIMARY KEY CLUSTERED
(
[IX_ConceptID]
) ON [PRIMARY]
GO

ALTER TABLE [dbo].[IX_ConcurrentUse] WITH NOCHECK ADD
CONSTRAINT [PK_IX_ConcurrentUse] PRIMARY KEY CLUSTERED
(
[IX_ConcurrentUseID]
) ON [PRIMARY]
GO

ALTER TABLE [dbo].[IX_DocumentConcepts] WITH NOCHECK ADD
CONSTRAINT [PK_IX_DocumentConcepts] PRIMARY KEY CLUSTERED
(
[IX_DocumentConceptID]
) ON [PRIMARY]
GO

ALTER TABLE [dbo].[IX_DocumentFolders] WITH NOCHECK ADD
CONSTRAINT [PK_IX_DocumentFolders] PRIMARY KEY CLUSTERED
(
[IX_DocumentFolderID]
) ON [PRIMARY]
GO

ALTER TABLE [dbo].[IX_DocumentKeywords] WITH NOCHECK ADD
CONSTRAINT [PK_IX_DocumentKeywords] PRIMARY KEY CLUSTERED
(
[IX_DocumentKeywordID]
) ON [PRIMARY]
GO

ALTER TABLE [dbo].[IX_DocumentWordOrders] WITH NOCHECK ADD
CONSTRAINT [PK_IX_DocumentWordOrders] PRIMARY KEY CLUSTERED
(
[IX_DocumentWordOrderID]
) ON [PRIMARY]
GO

ALTER TABLE [dbo].[IX_Documents] WITH NOCHECK ADD
CONSTRAINT [PK_IX_Documents] PRIMARY KEY CLUSTERED
(
[IX_DocumentID]
) ON [PRIMARY]
GO

ALTER TABLE [dbo].[IX_FolderConcepts] WITH NOCHECK ADD
CONSTRAINT [PK_IX_FolderConcepts] PRIMARY KEY CLUSTERED
(
[IX_FolderConceptID]
) ON [PRIMARY]
GO

ALTER TABLE [dbo].[IX_Folders] WITH NOCHECK ADD
CONSTRAINT [PK_IX_Folders] PRIMARY KEY CLUSTERED
(
[IX_FolderID]
) ON [PRIMARY]
GO

ALTER TABLE [dbo].[IX_Messages] WITH NOCHECK ADD
CONSTRAINT [PK_IX_Messages] PRIMARY KEY CLUSTERED
(
[IX_MessageID]
) ON [PRIMARY]
GO

ALTER TABLE [dbo].[IX_ProjectConcepts] WITH NOCHECK ADD
CONSTRAINT [PK_IX_ProjectConcepts] PRIMARY KEY CLUSTERED
(
[IX_ProjectConceptID]
) ON [PRIMARY]
GO

ALTER TABLE [dbo].[IX_Projects] WITH NOCHECK ADD
CONSTRAINT [PK_IX_Projects] PRIMARY KEY CLUSTERED
(
[IX_ProjectID]
) ON [PRIMARY]
GO

ALTER TABLE [dbo].[IX_UserDocumentEvents] WITH NOCHECK ADD
CONSTRAINT [PK_IX_UserDocumentEvents] PRIMARY KEY CLUSTERED
(
[IX_UserDocumentEvents]
) ON [PRIMARY]
GO

ALTER TABLE [dbo].[IX_UserViews] WITH NOCHECK ADD
CONSTRAINT [PK_IX_UserViews] PRIMARY KEY CLUSTERED
(
[IX_UserViewID]
) ON [PRIMARY]
GO

ALTER TABLE [dbo].[IX_Users] WITH NOCHECK ADD
CONSTRAINT [PK_IX_Users] PRIMARY KEY CLUSTERED
(
[IX_UserID]
) ON [PRIMARY]
GO

ALTER TABLE [dbo].[IX_ViewConcepts] WITH NOCHECK ADD
CONSTRAINT [PK_IX_ViewConcepts] PRIMARY KEY CLUSTERED
(
[IX_ViewConceptID]
) ON [PRIMARY]
GO

ALTER TABLE [dbo].[IX_Views] WITH NOCHECK ADD
CONSTRAINT [PK_IX_Views] PRIMARY KEY CLUSTERED
(
[IX_ViewID]
) ON [PRIMARY]
GO

CREATE INDEX [IX_ViewLocks_ViewID] ON [dbo].[IX_ViewLocks]([ViewID]) ON [PRIMARY]
GO

CREATE INDEX [IX_ViewLocks_MessageID] ON [dbo].[IX_ViewLocks]([MessageID]) ON [PRIMARY]
GO

CREATE INDEX [IX_ConceptExpressions_ConceptID] ON [dbo].[IX_ConceptExpressions]([IX_ConceptID]) ON [PRIMARY]
GO

CREATE INDEX [IX_Concepts_Type] ON [dbo].[IX_Concepts]([IX_Type]) ON [PRIMARY]
GO

CREATE UNIQUE INDEX [IX_Concepts_Name_Type_ContextID] ON [dbo].[IX_Concepts]([IX_Name], [IX_Type], [IX_ContextID]) ON [PRIMARY]
GO

CREATE INDEX [IX_ConcurrentUse_UserID] ON [dbo].[IX_ConcurrentUse]([IX_UserID]) ON [PRIMARY]
GO

CREATE INDEX [IX_DocumentConcepts_DocumentID] ON [dbo].[IX_DocumentConcepts]([IX_DocumentID]) ON [PRIMARY]
GO

CREATE INDEX [IX_DocumentConcepts_FolderConceptID] ON [dbo].[IX_DocumentConcepts]([IX_FolderConceptID]) ON [PRIMARY]
GO

CREATE INDEX [IX_DocumentFolders_DocumentID] ON [dbo].[IX_DocumentFolders]([IX_DocumentID]) ON [PRIMARY]
GO

CREATE INDEX [IX_DocumentFolders_FolderID] ON [dbo].[IX_DocumentFolders]([IX_FolderID]) ON [PRIMARY]
GO

CREATE INDEX [IX_DocumentKeywords_DocumentID] ON [dbo].[IX_DocumentKeywords]([IX_DocumentID]) ON [PRIMARY]
GO

CREATE INDEX [IX_DocumentKeywords_ConceptID] ON [dbo].[IX_DocumentKeywords]([IX_ConceptID]) ON [PRIMARY]
GO

CREATE UNIQUE INDEX [IX_DocumentKeywords_DocumentID_ConceptID] ON [dbo].[IX_DocumentKeywords]([IX_DocumentID],[IX_Co nceptID]) ON [PRIMARY]
GO

CREATE INDEX [IX_DocumentWordOrders_DocumentKeywordsID] ON [dbo].[IX_DocumentWordOrders]([IX_DocumentKeywordI D]) ON [PRIMARY]
GO

CREATE UNIQUE INDEX [IX_Documents_Path_Name] ON [dbo].[IX_Documents]([IX_Path], [IX_Name]) ON [PRIMARY]
GO

CREATE INDEX [IX_FolderConcepts_FolderID] ON [dbo].[IX_FolderConcepts]([IX_FolderID]) ON [PRIMARY]
GO

CREATE INDEX [IX_FolderConcepts_ConceptID] ON [dbo].[IX_FolderConcepts]([IX_ConceptID]) ON [PRIMARY]
GO

CREATE UNIQUE INDEX [IX_FolderConcepts_FolderID_ConceptID] ON [dbo].[IX_FolderConcepts]([IX_FolderID], [IX_ConceptID]) ON [PRIMARY]
GO

CREATE UNIQUE INDEX [IX_Folders_ViewID_Name] ON [dbo].[IX_Folders]([IX_ViewID], [IX_Name]) ON [PRIMARY]
GO

CREATE INDEX [IX_Folders_ViewID] ON [dbo].[IX_Folders]([IX_ViewID]) ON [PRIMARY]
GO

CREATE INDEX [IX_ProjectConcepts_ProjectID] ON [dbo].[IX_ProjectConcepts]([IX_ProjectID]) ON [PRIMARY]
GO

CREATE INDEX [IX_ProjectConcepts_ConceptID] ON [dbo].[IX_ProjectConcepts]([IX_ConceptID]) ON [PRIMARY]
GO

CREATE INDEX [IX_Projects_ClientID] ON [dbo].[IX_Projects]([IX_ClientID]) ON [PRIMARY]
GO

CREATE INDEX [IX_UserDocumentEvents_UserEventID] ON [dbo].[IX_UserDocumentEvents]([IX_UserEventID]) ON [PRIMARY]
GO

CREATE INDEX [IX_UserDocumentEvents_DocumentID] ON [dbo].[IX_UserDocumentEvents]([IX_DocumentID]) ON [PRIMARY]
GO

CREATE INDEX [IX_UserViews_UserID] ON [dbo].[IX_UserViews]([IX_UserID]) ON [PRIMARY]
GO

CREATE INDEX [IX_UserViews_ViewID] ON [dbo].[IX_UserViews]([IX_ViewID]) ON [PRIMARY]
GO

CREATE INDEX [IX_ViewConcepts_ViewID] ON [dbo].[IX_ViewConcepts]([IX_ViewID]) ON [PRIMARY]
GO

CREATE INDEX [IX_ViewConcepts_ConceptID] ON [dbo].[IX_ViewConcepts]([IX_ConceptID]) ON [PRIMARY]
GO

CREATE UNIQUE INDEX [IX_ViewConcepts_ViewID_ConceptID_ReplacementID] ON [dbo].[IX_ViewConcepts]([IX_ViewID], [IX_ConceptID], [IX_ReplacementID]) ON [PRIMARY]
GO

CREATE INDEX [IX_Views_ProjectID] ON [dbo].[IX_Views]([IX_ProjectID]) ON [PRIMARY]
GO

CREATE UNIQUE INDEX [IX_Views_Name_ProjectId_Type_Status] ON [dbo].[IX_Views]([IX_Name], [IX_ProjectID], [IX_Type], [IX_Status]) ON [PRIMARY]
GO
CREATE UNIQUE INDEX [IX_Projects_Name_ClientId_Type_Status] ON [dbo].[IX_Projects]([IX_Name], [IX_ClientId], [IX_Type], [IX_Status]) ON [PRIMARY]
GO

CREATE TABLE [dbo].[IX_UserSettings] (
[IX_UserSettingID] [bigint] IDENTITY (1, 1) NOT NULL ,
[IX_UserViewID] [bigint] NOT NULL ,
[IX_Component] [varchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[IX_Name] [varchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[IX_Value] [varchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[IX_Type] [varchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[IX_Status] [varchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[IX_CreationDate] [datetime] NOT NULL ,
[IX_LastUpdateDate] [datetime] NOT NULL
) ON [PRIMARY]
GO

ALTER TABLE [dbo].[IX_UserSettings] WITH NOCHECK ADD
CONSTRAINT [PK_IX_UserSettingID] PRIMARY KEY CLUSTERED
(
[IX_UserSettingID]
) ON [PRIMARY]
GO

CREATE INDEX [IX_UserSettings_UserSettingID] ON [dbo].[IX_UserSettings]([IX_UserSettingID]) ON [PRIMARY]
GO

CREATE INDEX [IX_UserSettings_UserViewID] ON [dbo].[IX_UserSettings]([IX_UserViewID]) ON [PRIMARY]
GO

CREATE TABLE [dbo].[IX_MessageThreads] (
[IX_ID] [bigint] IDENTITY (1,1) NOT NULL CONSTRAINT [IX_MessagingThreads_ID_U_C_IDX] Primary Key,
[IX_MachineId] [varchar] (500) NOT NULL,
[IX_InstanceId] [varchar] (500) NOT NULL,
[IX_ThreadName] [varchar] (500) NOT NULL,
[IX_ParentId] [bigint] NOT NULL,
[IX_Status] [varchar] (100) NOT NULL,
[IX_Type] [varchar] (10) NOT NULL,
[IX_Activity] [varchar] (500) NOT NULL,
[IX_BatchID] [bigint] NOT NULL,
[IX_CreationDate] [datetime] NOT NULL,
[IX_LastUpdated] [datetime] NOT NULL
) ON [PRIMARY]
GO
CREATE UNIQUE INDEX [IX_DocumentConcepts_FolderConceptID_DocumentID] ON [dbo].[IX_DocumentConcepts]([IX_FolderConceptID], [IX_DocumentID]) ON [PRIMARY]
GO

ALTER TABLE tbuielement
ALTER COLUMN uielement_id
float
NOT NULL
GO
ALTER TABLE menu_structure
ALTER COLUMN [Menu_Id]
float
NOT NULL
GO
ALTER TABLE menu_structure
ALTER COLUMN [Parent_Menu_Id]
float
NOT NULL
GO
ALTER TABLE menu_structure
ALTER COLUMN [Level_Id]
float
NOT NULL
GO


ALTER TABLE [dbo].[Menu_Structure] WITH NOCHECK ADD
CONSTRAINT [PK_Menu_Structur] PRIMARY KEY CLUSTERED
(
[Menu_Id],
[Parent_Menu_Id],
[Level_Id]
) ON [PRIMARY]
GO


ALTER TABLE [dbo].[TbUIElement] WITH NOCHECK ADD
CONSTRAINT [PK_TbUIElement] PRIMARY KEY CLUSTERED
(
[UIElement_Id]
) ON [PRIMARY]
GO

ALTER TABLE [dbo].[TbKeyExcl] WITH NOCHECK ADD
CONSTRAINT [PK_TbKeyExcl] PRIMARY KEY CLUSTERED
(
[Keyword_Name]
) ON [PRIMARY]
GO

ALTER TABLE [dbo].[TbKeyExcl]
DROP CONSTRAINT [PK_TbKeyExcl]
GO

ALTER TABLE [dbo].[TbKeyExcl] WITH NOCHECK
ADD CONSTRAINT [UC_KeywordName] UNIQUE
(
[Keyword_Name]
) ON [PRIMARY]
GO

ALTER TABLE [dbo].[TbKeyExcl] WITH NOCHECK
ADD CONSTRAINT [PK_TbKeyExcl] PRIMARY KEY CLUSTERED
(
[Keyword_Id]
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[IX_DRDocHits] (
[report_id] [int] NOT NULL ,
[DocNM] [varchar] (512) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[KID] [varchar] (56) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[Offset] [int] NOT NULL
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[IX_DRKIDList] (
[report_id] [int] NOT NULL ,
[ListNum] [smallint] NOT NULL ,
[KID] [varchar] (56) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL
) ON [PRIMARY]
GO

ALTER TABLE [dbo].[IX_ConceptExpressions]
DROP COLUMN IX_XSL
GO

ALTER TABLE [dbo].[IX_ConceptExpressions]
ADD [IX_Control] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL DEFAULT ''
GO

------------------------------------END IxTablesUpgrade.sql------------------------------- ------

------------------------------------BEGIN IxSprocs.sql-------------------------------------

if exists (select * from dbo.sysobjects where ID = object_id(N'[dbo].[IX_DeleteNoiseWord]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_DeleteNoiseWord]
GO

if exists (select * from dbo.sysobjects where ID = object_id(N'[dbo].[IX_GetAllNoiseWords]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetAllNoiseWords]
GO

if exists (select * from dbo.sysobjects where ID = object_id(N'[dbo].[IX_GetNoiseWord]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetNoiseWord]
GO

if exists (select * from dbo.sysobjects where ID = object_id(N'[dbo].[IX_InsertNoiseWord]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_InsertNoiseWord]
GO

if exists (select * from dbo.sysobjects where ID = object_id(N'[dbo].[IX_UpdateNoiseWord]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_UpdateNoiseWord]
GO

if exists (select * from dbo.sysobjects where ID = object_id(N'[dbo].[IX_GetNoiseWordConceptID]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetNoiseWordConceptID]
GO

if exists (select * from dbo.sysobjects where ID = object_id(N'[dbo].[IX_GetErrorMessage]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetErrorMessage]
GO

if exists (select * from dbo.sysobjects where ID = object_id(N'[dbo].[IX_GetErrorMessageByUserID]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetErrorMessageByUserID]
GO

if exists (select * from dbo.sysobjects where ID = object_id(N'[dbo].[IX_GetErrorMessageByUserIDByPro jectID]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetErrorMessageByUserIDByProjectID]
GO

if exists (select * from dbo.sysobjects where ID = object_id(N'[dbo].[IX_GetNoiseWordID]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetNoiseWordID]
GO

if exists (select * from dbo.sysobjects where ID = object_id(N'[dbo].[IX_GetErrorMessageID]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetErrorMessageID]
GO

if exists (select * from dbo.sysobjects where ID = object_id(N'[dbo].[IX_InsertErrorMessage]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_InsertErrorMessage]
GO

if exists (select * from dbo.sysobjects where ID = object_id(N'[dbo].[IX_UpdateErrorMessage]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_UpdateErrorMessage]
GO

if exists (select * from dbo.sysobjects where ID = object_id(N'[dbo].[IX_DeleteErrorMessage]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_DeleteErrorMessage]
GO

if exists (select * from dbo.sysobjects where ID = object_id(N'[dbo].[IX_GetDtSearchPath]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetDtSearchPath]
GO

if exists (select * from dbo.sysobjects where ID = object_id(N'[dbo].[IX_InsertReportFolder]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_InsertReportFolder]
GO

if exists (select * from dbo.sysobjects where ID = object_id(N'[dbo].[IX_DeleteReportFolder]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_DeleteReportFolder]
GO

if exists (select * from dbo.sysobjects where ID = object_id(N'[dbo].[IX_InsertScheduledReportFolder] ') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_InsertScheduledReportFolder]
GO

if exists (select * from dbo.sysobjects where ID = object_id(N'[dbo].[IX_DeleteScheduledReportFolder] ') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_DeleteScheduledReportFolder]
GO

if exists (select * from dbo.sysobjects where ID = object_id(N'[dbo].[IX_GetRequestedReportIdForInser t]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetRequestedReportIdForInsert]
GO

if exists (select * from dbo.sysobjects where ID = object_id(N'[dbo].[IX_GetRequestedReport]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetRequestedReport]
GO

if exists (select * from dbo.sysobjects where ID = object_id(N'[dbo].[IX_InsertRequestedReport]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_InsertRequestedReport]
GO

if exists (select * from dbo.sysobjects where ID = object_id(N'[dbo].[IX_DeleteRequestedReport]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_DeleteRequestedReport]
GO

if exists (select * from dbo.sysobjects where ID = object_id(N'[dbo].[IX_GetScheduledReportIdForInser t]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetScheduledReportIdForInsert]
GO

if exists (select * from dbo.sysobjects where ID = object_id(N'[dbo].[IX_GetScheduledReport]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetScheduledReport]
GO

if exists (select * from dbo.sysobjects where ID = object_id(N'[dbo].[IX_InsertScheduledReport]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_InsertScheduledReport]
GO

if exists (select * from dbo.sysobjects where ID = object_id(N'[dbo].[IX_DeleteScheduledReport]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_DeleteScheduledReport]
GO

if exists (select * from dbo.sysobjects where ID = object_id(N'[dbo].[IX_GetAnalysisResultByRequested ReportID]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetAnalysisResultByRequestedReportID]
GO

if exists (select * from dbo.sysobjects where ID = object_id(N'[dbo].[IX_DeleteAnalysisResult]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_DeleteAnalysisResult]
GO

if exists (select * from dbo.sysobjects where ID = object_id(N'[dbo].[IX_GetConstant]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetConstant]
GO

if exists (select * from dbo.sysobjects where ID = object_id(N'[dbo].[IX_GetAllConstants]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetAllConstants]
GO

if exists (select * from dbo.sysobjects where ID = object_id(N'[dbo].[IX_InsertConstant]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_InsertConstant]
GO

if exists (select * from dbo.sysobjects where ID = object_id(N'[dbo].[IX_UpdateConstant]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_UpdateConstant]
GO

if exists (select * from dbo.sysobjects where ID = object_id(N'[dbo].[IX_DeleteConstant]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_DeleteConstant]
GO

if exists (select * from dbo.sysobjects where ID = object_id(N'[dbo].[IX_DeleteMultipleRequestedRepor ts]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_DeleteMultipleRequestedReports]
GO

if exists (select * from dbo.sysobjects where ID = object_id(N'[dbo].[IX_GetAllRequestedReports]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetAllRequestedReports]
GO

if exists (select * from dbo.sysobjects where ID = object_id(N'[dbo].[IX_GetRequestedReportByStatus]' ) and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetRequestedReportByStatus]
GO

if exists (select * from dbo.sysobjects where ID = object_id(N'[dbo].[IX_DeleteMultipleScheduledRepor ts]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_DeleteMultipleScheduledReports]
GO

if exists (select * from dbo.sysobjects where ID = object_id(N'[dbo].[IX_GetAllScheduledReports]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetAllScheduledReports]
GO

if exists (select * from dbo.sysobjects where ID = object_id(N'[dbo].[IX_GetScheduledReportByStatus]' ) and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetScheduledReportByStatus]
GO

if exists (select * from dbo.sysobjects where ID = object_id(N'[dbo].[IX_GetAllAnalysisResults]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetAllAnalysisResults]
GO

if exists (select * from dbo.sysobjects where ID = object_id(N'[dbo].[IX_GetAnalysisResultsByRequeste dReportIdList]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetAnalysisResultsByRequestedReportIdLis t]
GO

if exists (select * from dbo.sysobjects where ID = object_id(N'[dbo].[IX_DeleteAnalysisResults]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_DeleteAnalysisResults]
GO

if exists (select * from dbo.sysobjects where ID = object_id(N'[dbo].[IX_GetAllTbReports]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetAllTbReports]
GO

if exists (select * from dbo.sysobjects where ID = object_id(N'[dbo].[IX_GetTbReportById]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetTbReportById]
GO

if exists (select * from dbo.sysobjects where ID = object_id(N'[dbo].[IX_GetTbReportByType]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetTbReportByType]
GO

if exists (select * from dbo.sysobjects where ID = object_id(N'[dbo].[IX_GetTbReportByIdList]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetTbReportByIdList]
GO

if exists (select * from dbo.sysobjects where ID = object_id(N'[dbo].[IX_DeleteTbReportById]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_DeleteTbReportById]
GO

if exists (select * from dbo.sysobjects where ID = object_id(N'[dbo].[IX_DeleteTbReportByIdList]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_DeleteTbReportByIdList]
GO

if exists (select * from dbo.sysobjects where ID = object_id(N'[dbo].[IX_InsertTbReport]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_InsertTbReport]
GO

if exists (select * from dbo.sysobjects where ID = object_id(N'[dbo].[IX_InsertAnalysisResult]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_InsertAnalysisResult]
GO

if exists (select * from dbo.sysobjects where ID = object_id(N'[dbo].[IX_GetFilterConceptByKeywordId] ') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetFilterConceptByKeywordId]
GO

if exists (select * from dbo.sysobjects where ID = object_id(N'[dbo].[IX_GetFilterConceptsByKeywordId List]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetFilterConceptsByKeywordIdList]
GO

if exists (select * from dbo.sysobjects where ID = object_id(N'[dbo].[IX_GetKeywordByKeywordId]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetKeywordByKeywordId]
GO

if exists (select * from dbo.sysobjects where ID = object_id(N'[dbo].[IX_GetKeywordsByKeywordIdList]' ) and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetKeywordsByKeywordIdList]
GO

if exists (select * from dbo.sysobjects where ID = object_id(N'[dbo].[IX_GetFilterConceptsByUserId]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetFilterConceptsByUserId]
GO

if exists (select * from dbo.sysobjects where ID = object_id(N'[dbo].[IX_DeleteReportFoldersByReportI dList]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_DeleteReportFoldersByReportIdList]
GO

if exists (select * from dbo.sysobjects where ID = object_id(N'[dbo].[IX_DeleteScheduledReportFolders ByReportIdList]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_DeleteScheduledReportFoldersByReportIdLi st]
GO

if exists (select * from dbo.sysobjects where ID = object_id(N'[dbo].[IX_UpdateStatusForKeyxKey]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_UpdateStatusForKeyxKey]
GO

if exists (select * from dbo.sysobjects where ID = object_id(N'[dbo].[IX_InsertIntoKeyxKey]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_InsertIntoKeyxKey]
GO

if exists (select * from dbo.sysobjects where ID = object_id(N'[dbo].[IX_GetUserObjectResultByRequest edUserObjectID]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetUserObjectResultByRequestedUserObject ID]
GO
if exists (select * from dbo.sysobjects where ID = object_id(N'[dbo].[IX_GetUserObjectResultsByReques tedUserObjectIDList]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetUserObjectResultsByRequestedUserObjec tIDList]
GO

if exists (select * from dbo.sysobjects where ID = object_id(N'[dbo].[IX_GetObjectResultByRequestedOb jectID]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetObjectResultByRequestedObjectID]
GO

if exists (select * from dbo.sysobjects where ID = object_id(N'[dbo].[IX_GetObjectResultsByRequestedO bjectIDList]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetObjectResultsByRequestedObjectIDList]
GO

if exists (select * from dbo.sysobjects where ID = object_id(N'[dbo].[IX_LoadDirectoryResultsByDirNam e]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_LoadDirectoryResultsByDirName]
GO

if exists (select * from dbo.sysobjects where ID = object_id(N'[dbo].[IX_InsertDirectory]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_InsertDirectory]
GO

if exists (select * from dbo.sysobjects where ID = object_id(N'[dbo].[IX_DeleteDirXUser]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_DeleteDirXUser]
GO

if exists (select * from dbo.sysobjects where ID = object_id(N'[dbo].[IX_UpdateSyncStatusText]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_UpdateSyncStatusText]
GO

if exists (select * from dbo.sysobjects where ID = object_id(N'[dbo].[IX_InsertDirXUser]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_InsertDirXUser]
GO

if exists (select * from dbo.sysobjects where ID = object_id(N'[dbo].[IX_GetDocumentById]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetDocumentById]
GO

if exists (select * from dbo.sysobjects where ID = object_id(N'[dbo].[IX_GetSyncStatusForViewDirector y]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetSyncStatusForViewDirectory]
GO

if exists (select * from dbo.sysobjects where ID = object_id(N'[dbo].[IX_GetResultsFromViewDirectoryW ithSyncStatusC]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetResultsFromViewDirectoryWithSyncStatu sC]
GO

if exists (select * from dbo.sysobjects where ID = object_id(N'[dbo].[IX_GetResultsFromViewDirectoryW ithSyncStatusNorP]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetResultsFromViewDirectoryWithSyncStatu sNorP]
GO

if exists (select * from dbo.sysobjects where ID = object_id(N'[dbo].[IX_GetResultsFromViewDirectoryW ithSyncStatusN]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetResultsFromViewDirectoryWithSyncStatu sN]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_GetUserPrefResultsByUserId]' ) and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetUserPrefResultsByUserId]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_GetDefaultUserDirectoryByUse rNumber]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetDefaultUserDirectoryByUserNumber]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_GetEnvironResults]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetEnvironResults]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_GetSearchEngineInfoResultsWi thPriorityOne]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetSearchEngineInfoResultsWithPriorityOn e]
GO

if exists (select * from dbo.sysobjects where ID = object_id(N'[dbo].[IX_GetDescriptionByUserNumber]' ) and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetDescriptionByUserNumber]
GO

if exists (select * from dbo.sysobjects where ID = object_id(N'[dbo].[IX_GetHyperlinkByObjectId]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetHyperlinkByObjectId]
GO

if exists (select * from dbo.sysobjects where ID = object_id(N'[dbo].[IX_GetUserPrefValueByUserId]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetUserPrefValueByUserId]
GO

if exists (select * from dbo.sysobjects where ID = object_id(N'[dbo].[IX_GetAnalysisResultsByRequeste dProjectIdList]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetAnalysisResultsByRequestedProjectIdLi st]
GO

if exists (select * from dbo.sysobjects where ID = object_id(N'[dbo].[IX_GetRequestedReportResultsByP rojectIdList]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetRequestedReportResultsByProjectIdList ]
GO

if exists (select * from dbo.sysobjects where ID = object_id(N'[dbo].[IX_GetScheduledReportResultsByP rojectIdList]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetScheduledReportResultsByProjectIdList ]
GO

if exists (select * from dbo.sysobjects where ID = object_id(N'[dbo].[IX_GetTbReportByProjectIdList]' ) and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetTbReportByProjectIdList]
GO

if exists (select * from dbo.sysobjects where ID = object_id(N'[dbo].[IX_UpdateAnalysisResult]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_UpdateAnalysisResult]
GO

if exists (select * from dbo.sysobjects where ID = object_id(N'[dbo].[IX_GetUserIdByUserNumber]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetUserIdByUserNumber]
GO

if exists (select * from dbo.sysobjects where ID = object_id(N'[dbo].[IX_GetReportUserObjectByReportI d]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetReportUserObjectByReportId]
GO

if exists (select * from dbo.sysobjects where ID = object_id(N'[dbo].[IX_GetTbReportByProjectId]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetTbReportByProjectId]
GO

if exists (select * from dbo.sysobjects where ID = object_id(N'[dbo].[IX_GetTbReportByProjectIdAndTyp e]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetTbReportByProjectIdAndType]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_GetAnalysisJobsByStatusAndVi ewList]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetAnalysisJobsByStatusAndViewList]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_GetAnalysisJobsCountByStatus AndUserId]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetAnalysisJobsCountByStatusAndUserId]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_GetAnalysisJobsCountByStatus AndViewList]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetAnalysisJobsCountByStatusAndViewList]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_GetBatchProcessJobsByStatusA ndViewList]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetBatchProcessJobsByStatusAndViewList]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_GetBatchProcessJobsCountBySt atusAndUserId]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetBatchProcessJobsCountByStatusAndUserI d]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_GetBatchProcessJobsCountBySt atusAndViewList]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetBatchProcessJobsCountByStatusAndViewL ist]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_GetLanSyncJobsByStatusAndVie wList]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetLanSyncJobsByStatusAndViewList]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_GetLanSyncJobsCountByStatusA ndViewList]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetLanSyncJobsCountByStatusAndViewList]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_GetLanSyncJobsDetails]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetLanSyncJobsDetails]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_GetPublishJobsByStatusAndVie wList]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetPublishJobsByStatusAndViewList]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_GetPublishJobsCountByStatusA ndUserId]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetPublishJobsCountByStatusAndUserId]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_GetPublishJobsCountByStatusA ndViewList]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetPublishJobsCountByStatusAndViewList]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_GetUserViewList]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetUserViewList]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_GetDocumentImportance]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetDocumentImportance]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_GetAllFolders]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetAllFolders]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_GetAllKeywordConcepts]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetAllKeywordConcepts]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_GetAllOntologies]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetAllOntologies]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_GetAllProjects]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetAllProjects]
GO

if exists (select * from dbo.sysobjects where ID = object_id(N'[dbo].[IX_GetAllRequestMessages]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetAllRequestMessages]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_GetAllViewConcepts]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetAllViewConcepts]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_GetAllViews]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetAllViews]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_GetAllViewsByProjectId]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetAllViewsByProjectId]
GO



if exists (select * from dbo.sysobjects where ID = object_id(N'[dbo].[IX_GetBatchJobsByParentId]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetBatchJobsByParentId]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_GetConcept]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetConcept]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_GetConceptID]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetConceptID]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_GetConceptIdByViewID]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetConceptIdByViewID]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_GetConceptExpressionID]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetConceptExpressionID]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_GetConceptsByViewID]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetConceptsByViewID]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_GetFolderById]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetFolderById]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_GetFolderByName]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetFolderByName]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_GetFolderConceptID]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetFolderConceptID]
GO


if exists (select * from dbo.sysobjects where ID = object_id(N'[dbo].[IX_GetNextRequestMessageIdForPr ocessingByComponent]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetNextRequestMessageIdForProcessingByCo mponent]
GO

if exists (select * from dbo.sysobjects where ID = object_id(N'[dbo].[IX_GetProjectById]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetProjectById]
GO

if exists (select * from dbo.sysobjects where ID = object_id(N'[dbo].[IX_GetQueueMessageById]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetQueueMessageById]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_GetReplacementID]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetReplacementID]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_GetView]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetView]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_GetViewById]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetViewById]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_InsertConcept]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_InsertConcept]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_InsertConceptExpression]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_InsertConceptExpression]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_InsertDocument]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_InsertDocument]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_InsertDocumentConcept]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_InsertDocumentConcept]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_InsertDocumentFolder]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_InsertDocumentFolder]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_InsertDocumentKeyword]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_InsertDocumentKeyword]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_InsertDocumentWordOrder]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_InsertDocumentWordOrder]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_InsertFolder]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_InsertFolder]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_InsertFolderConcept]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_InsertFolderConcept]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_InsertProject]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_InsertProject]
GO

if exists (select * from dbo.sysobjects where ID = object_id(N'[dbo].[IX_InsertQueueMessage]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_InsertQueueMessage]
GO


if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_InsertView]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_InsertView]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_InsertViewConcept]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_InsertViewConcept]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_UpdateDocumentImportance]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_UpdateDocumentImportance]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_UpdateFolder]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_UpdateFolder]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_UpdateFolderConcept]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_UpdateFolderConcept]
GO

if exists (select * from dbo.sysobjects where ID = object_id(N'[dbo].[IX_UpdateQueueMessageById]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_UpdateQueueMessageById]
GO

if exists (select * from dbo.sysobjects where ID = object_id(N'[dbo].[IX_UpdateRequestMessageForProce ssingById]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_UpdateRequestMessageForProcessingById]
GO

if exists (select * from dbo.sysobjects where ID = object_id(N'[dbo].[IX_UpdateStatusForBatchingByID] ') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_UpdateStatusForBatchingByID]
GO

if exists (select * from dbo.sysobjects where ID = object_id(N'[dbo].[IX_UpdateStatusForProcessingByI d]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_UpdateStatusForProcessingById]
GO

if exists (select * from dbo.sysobjects where ID = object_id(N'[dbo].[IX_UpdateTasksRemainingById]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_UpdateTasksRemainingById]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_DeleteOntologiesByConceptIdL ist]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_DeleteOntologiesByConceptIdList]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_InsertOntology]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_InsertOntology]

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_GetConceptsByConceptExpressi on]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetConceptsByConceptExpression]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_GetDocumentCountByConceptIDa ndViewID]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetDocumentCountByConceptIDandViewID]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_GetConceptByConceptID]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetConceptByConceptID]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_GetFolderConceptsByCoceptID] ') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetFolderConceptsByCoceptID]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_UpdateFolderConceptStatusAct ive]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_UpdateFolderConceptStatusActive]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_UpdateFolderStatus]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_UpdateFolderStatus]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_GetConceptIdAndReplacementID ByViewId]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetConceptIdAndReplacementIDByViewId]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_UpdateDocumentKeywords]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_UpdateDocumentKeywords]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_ExistConceptExpression]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_ExistConceptExpression]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_GetConceptExpressionsByConce ptID]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetConceptExpressionsByConceptID]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_GEtConceptExpresionRowsByCon ceptMC]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GEtConceptExpresionRowsByConceptMC]
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_GetDocumentIDsByConceptIDand ViewID]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetDocumentIDsByConceptIDandViewID]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_UpdateFolderConceptsValidByC onceptID]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_UpdateFolderConceptsValidByConceptID]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_GetFolderIDsByDocumentIDAndV iewID]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetFolderIDsByDocumentIDAndViewID]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_GetConceptsByName]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetConceptsByName]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_GetConceptNameFromStemID]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetConceptNameFromStemID]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_GetAllDocumentIDsByViewID]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetAllDocumentIDsByViewID]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_GetDocumentIDsByConceptNameA ndViewID]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetDocumentIDsByConceptNameAndViewID]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_GetNameByConceptID]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetNameByConceptID]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_GetConceptIDForSense]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetConceptIDForSense]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_GetDocumentIDsByFolderID]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetDocumentIDsByFolderID]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_GetDocumentIDsByConceptRange ]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetDocumentIDsByConceptRange]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_GetDocumentIDsByConceptId]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetDocumentIDsByConceptId]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_InsertConcurrentUse]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_InsertConcurrentUse]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_GetUserNameAndSessionByDate] ') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetUserNameAndSessionByDate]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_GetDataIngestedByDate]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetDataIngestedByDate]
GO


if exists (select * from dbo.sysobjects where ID = object_id(N'[dbo].[IX_GetUserSettingsUserId]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetUserSettingsUserId]
GO

if exists (select * from dbo.sysobjects where ID = object_id(N'[dbo].[IX_GetGlobalUserSettingsUserId] ') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetGlobalUserSettingsUserId]
GO

if exists (select * from dbo.sysobjects where ID = object_id(N'[dbo].[IX_GetUserSettingsResultByUserI d]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetUserSettingsResultByUserId]
GO

if exists (select * from dbo.sysobjects where ID = object_id(N'[dbo].[IX_GetGlobalUserSettingsResultB yUserId]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetGlobalUserSettingsResultByUserId]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_GetUsersFromConcurrentUse]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetUsersFromConcurrentUse]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_GetTotalSizeOfIngestedData]' ) and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetTotalSizeOfIngestedData]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_GetTotalNumberOfUsers]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetTotalNumberOfUsers]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_InsertMessageThread]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_InsertMessageThread]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_GetMessageThread]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetMessageThread]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_GetTimeSlotAndSessionToCheck ForDuplicates]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetTimeSlotAndSessionToCheckForDuplicate s]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_GetUserSettingsResult]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetUserSettingsResult]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_GetGlobalUserSettingsResult] ') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetGlobalUserSettingsResult]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_GetMessageThreadID]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetMessageThreadID]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_UpdateMessageThread]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_UpdateMessageThread]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_GetMessageThreadResults]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetMessageThreadResults]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_DeleteMessageThread]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_DeleteMessageThread]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_GetWordOrderInDocument]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetWordOrderInDocument]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_GetSenseStrength]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetSenseStrength]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_GetViewConceptId]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetViewConceptId]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_UpdateSenseStrength]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_UpdateSenseStrength]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_OntologyInsert]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_OntologyInsert]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_OntologyDelete]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_OntologyDelete]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_OntologyGetList]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_OntologyGetList]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_OntologyGetTree]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_OntologyGetTree]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_OntologySetTree]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_OntologySetTree]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_DRByKeyWord_Lvl0]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_DRByKeyWord_Lvl0]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_DRByKeyWord_Lvl1]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_DRByKeyWord_Lvl1]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_DRByKeyWord_Lvl2]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_DRByKeyWord_Lvl2]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_DRByKeyWord_Lvl3]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_DRByKeyWord_Lvl3]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_DeleteDRDocHitsByReportId]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_DeleteDRDocHitsByReportId]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_DeleteDRKidListByReportId]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_DeleteDRKidListByReportId]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_GetChildConceptsByKeyWordID] ') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetChildConceptsByKeyWordID]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_LoadDRDocHits]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_LoadDRDocHits]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_LoadDRKeyWordIDList]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_LoadDRKeyWordIDList]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_UpdateReqReportStatus]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_UpdateReqReportStatus]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_getDRFileList]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_getDRFileList]
GO

CREATE PROCEDURE dbo.IX_DeleteNoiseWord
@NoiseWord varchar (100)
AS
DELETE FROM TBkeyexcl
WHERE keyword_name = @NoiseWord
GO

CREATE PROCEDURE dbo.IX_GetAllNoiseWords
AS
SELECT * FROM TBkeyexcl
ORDER BY keyword_name
GO

CREATE PROCEDURE dbo.IX_GetNoiseWord
@NoiseWord varchar (100)
AS
SELECT * FROM TBkeyexcl
WHERE keyword_name = @NoiseWord
GO

CREATE PROCEDURE dbo.IX_InsertNoiseWord
@NoiseWord varchar (100),
@EffectiveDate datetime,
@EndDate datetime,
@NoiseWordID int OUTPUT
AS
INSERT INTO TBkeyexcl (
keyword_name,
keyword_exclusion_eff_date,
keyword_exclusion_end_date )
VALUES (
@NoiseWord,
@EffectiveDate,
@EndDate )
SET @NoiseWordID = @@IDENTITY
GO

CREATE PROCEDURE dbo.IX_UpdateNoiseWord
@NoiseWord varchar(100),
@UpdateValue varchar (100),
@EffectiveDate datetime,
@EndDate datetime
AS
UPDATE TBkeyexcl
SET
keyword_name = @UpdateValue,
keyword_exclusion_eff_date = @EffectiveDate,
keyword_exclusion_end_date = @EndDate
WHERE keyword_name = @NoiseWord
GO

CREATE PROCEDURE dbo.IX_GetNoiseWordConceptID
@NoiseWord varchar (100)
AS
SELECT noise.keyword_name, keywords.ConceptType_id
FROM TBkeyexcl noise
JOIN TBkeywords keywords ON keyword.keyword_txt = noise.keyword_name
WHERE noise.keyworn_name = NoiseWord
GO

CREATE PROCEDURE dbo.IX_GetErrorMessageByUserIDByProjectID
@Component varchar (5),
@Method char (3),
@UserID int,
@ProjectID int
AS
SELECT *
FROM ErrorMessage
WHERE Component = @Component
AND Method = @Method
AND UserID = @UserID
AND ProjectID = @ProjectID
GO

CREATE PROCEDURE dbo.IX_GetErrorMessageByUserID
@Component varchar (5),
@Method char (3),
@UserID int
AS
SELECT *
FROM ErrorMessage
WHERE Component = @Component
AND Method = @Method
AND UserID = @UserID
AND ProjectID IS NULL
GO

CREATE PROCEDURE dbo.IX_GetErrorMessage
@Component varchar (5),
@Method char (3)
AS
SELECT *
FROM ErrorMessage
WHERE Component = @Component
AND Method = @Method
AND UserID IS NULL
AND ProjectID IS NULL
GO

CREATE PROCEDURE dbo.IX_GetNoiseWordID
@NoiseWord varchar (100)
AS
SELECT keyword_id FROM TBkeyexcl
WHERE keyword_name = @NoiseWord
GO

CREATE PROCEDURE dbo.IX_InsertErrorMessage
@Type char (1),
@Component varchar (5),
@Method varchar (3),
@Message varchar (1000),
@UserID int,
@ProjectID int,
@ID int OUTPUT
AS
INSERT INTO ErrorMessage (
Type,
Component,
Method,
Message,
UserID,
ProjectID )
VALUES (
@Type,
@Component,
@Method,
@Message,
@UserID,
@ProjectID )
SET @ID = @@IDENTITY
GO

CREATE PROCEDURE dbo.IX_GetErrorMessageID
@Type char(1),
@Component varchar (5),
@Method char (3),
@UserID int,
@ProjectID int
AS
SELECT ID
FROM ErrorMessage
WHERE Type = @Type
AND Component = @Component
AND Method = @Method
AND UserID = @UserID
AND ProjectID = @ProjectID
GO

CREATE PROCEDURE dbo.IX_UpdateErrorMessage
@Type char (1),
@Component varchar (5),
@Method varchar (3),
@Message varchar (1000),
@UserID int,
@ProjectID int,
@ID int
AS
UPDATE ErrorMessage
SET
Type = @Type,
Component = @Component,
Method = @Method,
Message = @Message,
UserID = @UserID,
ProjectID = @ProjectID
WHERE ID = @ID
GO

CREATE PROCEDURE dbo.IX_DeleteErrorMessage
@ID int
AS
DELETE FROM ErrorMessage
WHERE ID = @ID
GO


CREATE PROCEDURE dbo.IX_GetDtSearchPath
AS
SELECT engine_path FROM tbenviron
GO


CREATE PROCEDURE dbo.IX_InsertReportFolder
@ReportId int,
@UserObjectId int
AS
INSERT INTO TbReportFolder (
report_id,
userobject_id )
VALUES (
@ReportId,
@UserObjectId )
GO



CREATE PROCEDURE dbo.IX_DeleteReportFolder
@ReportId int
AS
DELETE FROM TbReportFolder
WHERE report_id = @ReportId
GO


CREATE PROCEDURE dbo.IX_InsertScheduledReportFolder
@ReportId int,
@UserObjectId int
AS
INSERT INTO TbSchReportFolder (
report_id,
userobject_id )
VALUES (
@ReportId,
@UserObjectId )
GO


CREATE PROCEDURE dbo.IX_DeleteScheduledReportFolder
@ReportId int
AS
DELETE FROM TbSchReportFolder
WHERE report_id = @ReportId
GO

CREATE PROCEDURE dbo.IX_GetRequestedReportIdForInsert
AS
SELECT MAX(report_id)
FROM Tbreqreports
GO

CREATE PROCEDURE dbo.IX_GetRequestedReport
@UserNumber int,
@ReportID int
AS
SELECT *
FROM Tbreqreports
WHERE user_nbr = @UserNumber
AND report_id = @ReportID
GO

CREATE PROCEDURE dbo.IX_InsertRequestedReport
@ReportID int,
@UserNumber int,
@ReportType char(3),
@ReportName varchar (255),
@CompleteFlag char(1),
@RequestDate datetime,
@Parameter1 varchar (3500),
@Parameter2 varchar (3500),
@LastRan datetime,
@FileSize int,
@FileType char(3),
@DocumentCount int,
@Prefix char(5),
@FromDate datetime,
@ToDate datetime,
@FilterConcept int,
@RelationType char(3),
@Proximity tinyint,
@Cutoff tinyint,
@DrillDownLevel tinyint,
@ExportFrom char(7),
@ExecuteReport varchar(10),
@ReportTitle varchar(255),
@UserNumberForView int
AS
INSERT INTO Tbreqreports(
report_id,
User_nbr,
Report_type,
Report_name,
complete_flag,
mode_date_time,
str_parameter1,
str_parameter2,
last_run_time,
filesize,
filetype,
strdoccount,
strprefix,
strfrmDate,
strtoDate,
strFilterconcept,
RRelnType,
Rproximity,
Rcutoff,
Rddlevel,
strexportfrom,
executereport,
report_title,
user_nbr_for_view )
VALUES (
@ReportID,
@UserNumber,
@ReportType,
@ReportName,
@CompleteFlag,
@RequestDate,
@Parameter1,
@Parameter2,
@LastRan,
@FileSize,
@FileType,
@DocumentCount,
@Prefix,
@FromDate,
@ToDate,
@FilterConcept,
@RelationType,
@Proximity,
@Cutoff,
@DrillDownLevel,
@ExportFrom,
@ExecuteReport,
@ReportTitle,
@UserNumberForView )
GO

CREATE PROCEDURE dbo.IX_DeleteRequestedReport
@ReportID int
AS
DELETE FROM Tbreqreports
WHERE report_id = @ReportID
GO


CREATE PROCEDURE dbo.IX_GetScheduledReportIdForInsert
AS
SELECT MAX(report_id)
FROM TbSchReports
GO

CREATE PROCEDURE dbo.IX_GetScheduledReport
@UserNumber int,
@ReportID int
AS
SELECT *
FROM TbSchReports
WHERE user_nbr = @UserNumber
AND report_id = @ReportID
GO

CREATE PROCEDURE dbo.IX_InsertScheduledReport
@ReportID int,
@UserNumber int,
@ReportType char(3),
@ReportName varchar (255),
@CompleteFlag char(1),
@RequestDate datetime,
@Parameter1 varchar (3500),
@Parameter2 varchar (3500),
@LastRan datetime,
@FileSize int,
@FileType char(3),
@DocumentCount int,
@Prefix char(5),
@FromDate datetime,
@ToDate datetime,
@FilterConcept int,
@RelationType char(3),
@Proximity tinyint,
@Cutoff tinyint,
@DrillDownLevel tinyint,
@ExportFrom char(7),
@ExecuteReport varchar(10),
@ReportTitle varchar(255),
@UserNumberForView int,
@ScheduledStartDate datetime,
@ScheduledEndDate datetime,
@ScheduledRunFreq char(1),
@ScheduledRuntime datetime
AS
INSERT INTO TbSchReports(
report_id,
User_nbr,
Report_type,
Report_name,
complete_flag,
mode_date_time,
str_parameter1,
str_parameter2,
last_run_time,
filesize,
filetype,
strdoccount,
strprefix,
strfrmDate,
strtoDate,
strFilterconcept,
RRelnType,
Rproximity,
Rcutoff,
Rddlevel,
strexportfrom,
executereport,
report_title,
user_nbr_for_view,
schstartdate,
schenddate,
schrunfreq,
schruntime )
VALUES (
@ReportID,
@UserNumber,
@ReportType,
@ReportName,
@CompleteFlag,
@RequestDate,
@Parameter1,
@Parameter2,
@LastRan,
@FileSize,
@FileType,
@DocumentCount,
@Prefix,
@FromDate,
@ToDate,
@FilterConcept,
@RelationType,
@Proximity,
@Cutoff,
@DrillDownLevel,
@ExportFrom,
@ExecuteReport,
@ReportTitle,
@UserNumberForView,
@ScheduledStartDate,
@ScheduledEndDate,
@ScheduledRunFreq,
@ScheduledRuntime )
GO

CREATE PROCEDURE dbo.IX_DeleteScheduledReport
@ReportID int
AS
DELETE FROM TbSchReports
WHERE report_id = @ReportID
GO

CREATE PROCEDURE dbo.IX_GetAnalysisResultByRequestedReportID
@RequestedReportID int
AS
SELECT *
FROM IX_TbAnalysisResults
WHERE IX_ReqReport_Id = @RequestedReportID
GO

CREATE PROCEDURE dbo.IX_DeleteAnalysisResult
@ReportId int
AS
DELETE FROM IX_TbAnalysisResults
WHERE IX_reqreport_id = @ReportId
GO

CREATE PROCEDURE dbo.IX_GetConstant
@Description varchar(100)
AS
SELECT *
FROM TbConstant
WHERE description = @Description
GO

CREATE PROCEDURE dbo.IX_GetAllConstants
AS
SELECT *
FROM TbConstant
GO

CREATE PROCEDURE dbo.IX_InsertConstant
@Description varchar(100),
@Value int
AS
INSERT INTO TbConstant (
description,
value )
VALUES (
@Description,
@Value )
GO

CREATE PROCEDURE dbo.IX_UpdateConstant
@Description varchar(100),
@Value int
AS
UPDATE TbConstant
SET
description = @Description,
value = @Value
WHERE description = @Description
GO

CREATE PROCEDURE dbo.IX_DeleteConstant
@Description varchar(100)
AS
DELETE FROM TbConstant
WHERE description = @Description
GO



CREATE PROCEDURE dbo.IX_DeleteMultipleRequestedReports
@ReportIDList varchar (3500)
AS
DECLARE @sql nvarchar(3600)
SET @sql = 'DELETE FROM Tbreqreports ' +
'WHERE report_id IN (' + @ReportIDList + ')'
EXEC sp_executesql @sql, N'@ReportIDList varchar (3500)', @ReportIDList = @ReportIDList
GO


CREATE PROCEDURE dbo.IX_GetAllRequestedReports
AS
SELECT *
FROM Tbreqreports
Where Report_type != 'LFD'
ORDER BY report_name
GO


CREATE PROCEDURE dbo.IX_GetRequestedReportByStatus
@Status char(1)
AS
SELECT *
FROM Tbreqreports
WHERE complete_flag = @Status
GO


CREATE PROCEDURE dbo.IX_DeleteMultipleScheduledReports
@ReportIDList varchar (3500)
AS
DECLARE @sql nvarchar(3600)
SET @sql = 'DELETE FROM Tbschreports ' +
'WHERE report_id IN (' + @ReportIDList + ')'
EXEC sp_executesql @sql, N'@ReportIDList varchar (3500)', @ReportIDList = @ReportIDList
GO


CREATE PROCEDURE dbo.IX_GetAllScheduledReports
AS
SELECT *
FROM Tbschreports
Where Report_type != 'LFD'
ORDER BY report_name
GO


CREATE PROCEDURE dbo.IX_GetScheduledReportByStatus
@Status char(1)
AS
SELECT *
FROM Tbschreports
WHERE complete_flag = @Status
GO

CREATE PROCEDURE IX_GetAllAnalysisResults
AS
SELECT *
FROM IX_TbAnalysisResults
GO

CREATE PROCEDURE dbo.IX_GetAnalysisResultsByRequestedReportIdList
@ReportIdList varchar (3500)
AS
DECLARE @sql nvarchar(3600)
SET @sql = 'SELECT * FROM IX_TbAnalysisResult ' +
'WHERE IX_ReqReport_ID IN (' + @ReportIdList + ')'
EXEC sp_executesql @sql, N'@ReportIdList varchar (3500)', @ReportIdList = @ReportIdList
GO

CREATE PROCEDURE dbo.IX_DeleteAnalysisResults
@ReportIdList varchar (3500)
AS
DECLARE @sql nvarchar(3600)
SET @sql = 'DELETE FROM IX_TbAnalysisResult ' +
'WHERE IX_ReqReport_ID IN (' + @ReportIdList + ')'
EXEC sp_executesql @sql, N'@ReportIdList varchar (3500)', @ReportIdList = @ReportIdList
GO


CREATE PROCEDURE dbo.IX_GetAllTbReports
AS
SELECT *
FROM IX_TbReports
ORDER BY IX_Name
GO


CREATE PROCEDURE dbo.IX_GetTbReportById
@ID int
AS
SELECT *
FROM IX_TbReports
WHERE IX_ID = @ID
GO


CREATE PROCEDURE dbo.IX_GetTbReportByType
@Type varchar(2)
AS
SELECT *
FROM IX_TbReports
WHERE IX_Type = @Type
GO


CREATE PROCEDURE dbo.IX_GetTbReportByIdList
@IDList varchar (3500)
AS
DECLARE @sql nvarchar(3600)
SET @sql = 'SELECT * FROM IX_TbReports ' +
'WHERE IX_Id IN (' + @IDList + ')'
EXEC sp_executesql @sql, N'@IDList varchar (3500)', @IDList = @IDList
GO


CREATE PROCEDURE dbo.IX_DeleteTbReportById
@ID int
AS
DELETE FROM IX_TbReports
WHERE IX_Id = @ID
GO


CREATE PROCEDURE dbo.IX_DeleteTbReportByIdList
@IDList varchar (3500)
AS
DECLARE @sql nvarchar(3600)
SET @sql = 'DELETE FROM IX_TbReports ' +
'WHERE IX_Id IN (' + @IDList + ')'
EXEC sp_executesql @sql, N'@IDList varchar (3500)', @IDList = @IDList
GO


CREATE PROCEDURE dbo.IX_InsertTbReport
@UserNumber int,
@Type varchar(2),
@Name varchar(255),
@Description varchar(4000),
@DateCreated datetime,
@Report text,
@Category varchar(40),
@Format varchar(5),
@ID int OUTPUT
AS
INSERT INTO IX_TbReports (
IX_User_Nbr,
IX_Type,
IX_Name,
IX_Description,
IX_DateCreated,
IX_Report,
IX_Category,
IX_Format)
VALUES (
@UserNumber,
@Type,
@Name,
@Description,
@DateCreated,
@Report,
@Category,
@Format)
SET @ID = @@IDENTITY
GO


CREATE PROCEDURE dbo.IX_InsertAnalysisResult
@RequestedReportId int,
@UserNumber int,
@Type varchar(2),
@Name varchar(255),
@CompleteDate datetime,
@Result text,
@ID int OUTPUT
AS
INSERT INTO IX_TbAnalysisResults (
IX_ReqReport_ID,
IX_User_Nbr,
IX_Type,
IX_Name,
IX_CompleteDate,
IX_Result)
VALUES (
@RequestedReportId,
@UserNumber,
@Type,
@Name,
@CompleteDate,
@Result)
SET @ID = @@IDENTITY
GO

CREATE PROCEDURE dbo.IX_GetFilterConceptByKeywordId
@KeywordId int
AS
SELECT TbKeyword.keyword_id, TbKeyword.keyword_txt, TbKeyword.concepttype_id, TbConceptType.concepttype_description
FROM TbKeyword, TbConceptType
WHERE TbKeyword.concepttype_id = TbConceptType.concepttype_id and TbKeyword.keyword_id = @KeywordId
GO

CREATE PROCEDURE dbo.IX_GetFilterConceptsByKeywordIdList
@KeywordIdList varchar(3500)
AS
DECLARE @sql nvarchar(3600)
SET @sql = 'SELECT TbKeyword.keyword_id, TbKeyword.keyword_txt, TbKeyword.concepttype_id, TbConceptType.concepttype_description ' +
'FROM TbKeyword, TbConceptType ' +
'WHERE TbKeyword.concepttype_id = TbConceptType.concepttype_id and TbKeyword.keyword_id IN (' + @KeywordIdList + ')'
EXEC sp_executesql @sql, N'@KeywordIdList varchar (3500)', @KeywordIdList = @KeywordIdList
GO

CREATE PROCEDURE dbo.IX_GetKeywordByKeywordId
@KeywordId int
AS
SELECT *
FROM TbKeyword
WHERE keyword_id = @KeywordId
GO

CREATE PROCEDURE dbo.IX_GetKeywordsByKeywordIdList
@KeywordIdList varchar (3500)
AS
DECLARE @sql nvarchar(3600)
SET @sql = 'SELECT * FROM TbKeyword ' +
'WHERE keyword_id IN (' + @KeywordIdList + ')'
EXEC sp_executesql @sql, N'@KeywordIdList varchar (3500)', @KeywordIdList = @KeywordIdList
GO

CREATE PROCEDURE dbo.IX_GetFilterConceptsByUserId
@UserId int
AS
SELECT DISTINCT a.keyword_id, a.keyword_txt, d.concepttype_id, d.concepttype_description
FROM tbkeyword a, tbkeyxkey b, tbuserobject c, tbconcepttype d
WHERE a.keyword_id = b.parent_keyword_id and b.level_id = 0
AND b.status = 'A'
AND b.userobject_id = c.userobject_id
AND a.concepttype_id = d.concepttype_id
AND c.user_nbr = @UserId
ORDER BY a.keyword_txt ASC
GO

CREATE PROCEDURE dbo.IX_DeleteReportFoldersByReportIdList
@ReportIdList varchar (3500)
AS
DECLARE @sql nvarchar(3600)
SET @sql = 'DELETE FROM TbReportFolder ' +
'WHERE report_id IN (' + @ReportIdList + ')'
EXEC sp_executesql @sql, N'@ReportIdList varchar (3500)', @ReportIdList = @ReportIdList
GO

CREATE PROCEDURE dbo.IX_DeleteScheduledReportFoldersByReportIdList
@ReportIdList varchar (3500)
AS
DECLARE @sql nvarchar(3600)
SET @sql = 'DELETE FROM Tbschreports ' +
'WHERE report_id IN (' + @ReportIdList + ')'
EXEC sp_executesql @sql, N'@ReportIdList varchar (3500)', @ReportIdList = @ReportIdList
GO





CREATE PROCEDURE dbo.IX_UpdateStatusForKeyxKey
@ChildKeywordId int,
@ParentKeywordId int,
@UserObjectId int,
@LevelId int
AS
UPDATE TBkeyxkey
SET Status = 'A'
WHERE child_keyword_id = @ChildKeywordId AND parent_keyword_id = @ParentKeywordId
AND userobject_id = @UserObjectId AND level_id = @LevelId
GO

CREATE PROCEDURE dbo.IX_InsertIntoKeyxKey
@UserObjectId int,
@ParentKeywordId int,
@LevelId int,
@ChildkeywordId int

AS
INSERT INTO TBkeyxkey (
userobject_id,
parent_keyword_id,
level_id,
child_keyword_id,
Status )
VALUES (
@UserObjectId,
@ParentKeywordId,
@LevelId,
@ChildkeywordId,
'A')
GO

CREATE PROCEDURE dbo.IX_GetUserObjectResultByRequestedUserObjectID
@RequestedUserObjectID int
AS
SELECT *
FROM tbuserobject
WHERE userobject_id = @RequestedUserObjectID
GO

CREATE PROCEDURE dbo.IX_GetUserObjectResultsByRequestedUserObjectID List
@RequestedUserObjectIDList varchar (3500)
AS
DECLARE @sql nvarchar(3600)
SET @sql = 'SELECT * FROM tbuserobject ' +
'WHERE userobject_id IN (' + @RequestedUserObjectIDList + ')'
EXEC sp_executesql @sql, N'@RequestedUserObjectIDList varchar (3500)', @RequestedUserObjectIDList = @RequestedUserObjectIDList
GO

CREATE PROCEDURE dbo.IX_GetObjectResultByRequestedObjectID
@RequestedObjectID int
AS
SELECT *
FROM tbobject
WHERE object_id = @RequestedObjectID
GO

CREATE PROCEDURE dbo.IX_GetObjectResultsByRequestedObjectIDList
@ObjectIdList varchar (3500)
AS
DECLARE @sql nvarchar(3600)
SET @sql = 'SELECT * FROM tbobject ' +
'WHERE object_id IN (' + @ObjectIdList + ')'
EXEC sp_executesql @sql, N'@ObjectIdList varchar (3500)', @ObjectIdList = @ObjectIdList
GO

CREATE PROCEDURE dbo.IX_LoadDirectoryResultsByDirName
@DirName varchar (500)
AS
SELECT *
FROM tbDirectory
WHERE Dir_name = @DirName
GO

CREATE PROCEDURE dbo.IX_InsertDirectory(

@DirName varchar(500),
@IndexName varchar(255),
@DirNumber int output
)
AS
INSERT INTO tbDirectory( Dir_name, Str_indx_status, Indx_name)
VALUES (@DirName, 'N', @IndexName)

SET @DirNumber = @@IDENTITY
GO

CREATE PROCEDURE dbo.IX_DeleteDirXUser
@UserNumber int,
@DirNumber int
AS
DELETE FROM tbdirxuser
WHERE User_nbr = @UserNumber AND Dir_nbr = @DirNumber
GO

CREATE PROCEDURE dbo.IX_UpdateSyncStatusText
@DirNumber int,
@UserNumber int,
@FiltersStr varchar(255)

AS
UPDATE tbdirxuser
SET Sync_status_Text = 'R'
WHERE Dir_nbr = @DirNumber AND User_nbr = @UserNumber
AND Filters_str = @FiltersStr
GO

CREATE PROCEDURE dbo.IX_InsertDirXUser
@DirNumber int,
@FiltersStr varchar(255),
@UserNumber int,
@CompleteTime DateTime,
@RequestTime DateTime


AS
INSERT INTO tbdirxuser (
Dir_nbr, Filters_str, Complete_time,
User_nbr, Request_time, Sync_status_Text )
VALUES (
@DirNumber, @FiltersStr, @CompleteTime,
@UserNumber, @RequestTime, 'N' )
GO

CREATE PROCEDURE dbo.IX_GetDocumentById
@UserId int

AS
SELECT a.object_type, a.description, a.userobj_comments,
a.userobject_id,a.object_user_id,a.object_password ,
b.object_hyperlink, b.object_id
FROM tbuserobject a ,tbobject b
WHERE a.userobject_id = @UserId AND a.userobject_id = b.object_id
GO

CREATE PROCEDURE dbo.IX_GetSyncStatusForViewDirectory
@UserNumber int,
@FilterStr varchar (255),
@DirName varchar (500)

AS
SELECT tbdirxuser.Sync_status_Text,tbdirxuser.Dir_nbr,tbd irxuser.Filters_str
FROM tbdirectory,tbdirxuser
WHERE tbdirectory.Dir_nbr = tbdirxuser.Dir_nbr AND tbdirxuser.User_nbr=@UserNumber
AND tbdirxuser.Filters_str = @FilterStr AND Dir_name= @DirName
GO

CREATE PROCEDURE dbo.IX_GetResultsFromViewDirectoryWithSyncStatusC
@UserNumber int,
@FilterStr varchar (255),
@DirName varchar (500)

AS
SELECT *
FROM tbdirectory,tbdirxuser
WHERE tbdirxuser.Dir_nbr = tbdirectory.Dir_nbr AND User_nbr = @UserNumber AND Filters_str = @FilterStr
AND Sync_status_Text= 'C' AND tbdirectory.Dir_name = @DirName
GO


CREATE PROCEDURE dbo.IX_GetResultsFromViewDirectoryWithSyncStatusNo rP
@UserNumber int,
@FilterStr varchar (255),
@DirName varchar (500)

AS
SELECT *
FROM tbdirectory,tbdirxuser
WHERE tbdirxuser.Dir_nbr = tbdirectory.Dir_nbr AND User_nbr = @UserNumber AND Filters_str = @FilterStr
AND (Sync_status_Text = 'N' OR Sync_status_Text = 'P') AND tbdirectory.Dir_name = @DirName
GO

CREATE PROCEDURE dbo.IX_GetResultsFromViewDirectoryWithSyncStatusN
@UserNumber int,
@FilterStr varchar (255)

AS
SELECT *
FROM tbdirectory,tbdirxuser
WHERE tbdirxuser.Dir_nbr = tbdirectory.Dir_nbr AND User_nbr = @UserNumber AND Filters_str = @FilterStr
AND Sync_status_Text = 'N'
GO

CREATE PROCEDURE dbo.IX_GetUserPrefResultsByUserId
@UserId int
AS
SELECT * FROM user_pref
WHERE user_id = @UserId
AND user_pref_nbr = 1
GO

CREATE PROCEDURE dbo.IX_GetDefaultUserDirectoryByUserNumber
@UserNumber int
AS
SELECT * FROM tbuserid
WHERE user_nbr = @UserNumber
GO

CREATE PROCEDURE dbo.IX_GetEnvironResults
AS
SELECT * FROM tbenviron
GO

CREATE PROCEDURE dbo.IX_GetSearchEngineInfoResultsWithPriorityOne
AS
SELECT * FROM tbsearchengineinfo
WHERE priority = 1
GO

CREATE PROCEDURE dbo.IX_GetDescriptionByUserNumber
@UserNumber int
AS
SELECT distinct userobject_id, description,object_id
FROM Tbuserobject
WHERE user_nbr = @UserNumber AND object_type = 'F' AND displayflag not in ('P','D')
ORDER BY description asc
GO

CREATE PROCEDURE dbo.IX_GetHyperlinkByObjectId
@ObjectId int
AS
SELECT object_hyperlink
FROM tbobject
WHERE object_id = @ObjectId
GO

CREATE PROCEDURE dbo.IX_GetUserPrefValueByUserId
@UserId int
AS
Select user_pref_value
from user_pref
where user_pref_nbr = 16 and user_id = @UserId

GO

CREATE PROCEDURE dbo.IX_GetAnalysisResultsByRequestedProjectIdList
@IdList varchar (3500)
AS
DECLARE @sql nvarchar(3600)
SET @sql = 'SELECT * FROM IX_TbAnalysisResult ' +
'WHERE IX_User_Nbr IN (' + @IdList + ')'
EXEC sp_executesql @sql, N'@IdList varchar (3500)', @IdList = @IdList
GO

CREATE PROCEDURE dbo.IX_GetRequestedReportResultsByProjectIdList
@IdList varchar (3500)
AS
DECLARE @sql nvarchar(3600)
SET @sql = 'SELECT DISTINCT * FROM Tbreqreports ' +
'WHERE Report_type != ''LFD'' AND User_nbr IN (' + @IdList + ') ' +
'ORDER BY Report_name, report_id, User_nbr '
EXEC sp_executesql @sql, N'@IdList varchar (3500)', @IdList = @IdList
GO

CREATE PROCEDURE dbo.IX_GetScheduledReportResultsByProjectIdList
@IdList varchar (3500)
AS
DECLARE @sql nvarchar(3600)
SET @sql = 'SELECT DISTINCT * FROM Tbschreports ' +
'WHERE User_Nbr IN (' + @IdList + ') ' +
'ORDER BY Report_name, report_id, User_nbr '
EXEC sp_executesql @sql, N'@IdList varchar (3500)', @IdList = @IdList
GO

CREATE PROCEDURE dbo.IX_GetTbReportByProjectIdList
@IDList varchar (3500)
AS
DECLARE @sql nvarchar(3600)
SET @sql = 'SELECT * FROM IX_TbReports ' +
'WHERE IX_User_Nbr IN (' + @IDList + ')'
EXEC sp_executesql @sql, N'@IDList varchar (3500)', @IDList = @IDList
GO


CREATE PROCEDURE dbo.IX_UpdateAnalysisResult
@Result text,
@ID int
AS
UPDATE IX_TbAnalysisResults
SET IX_Result = @Result
WHERE IX_ReqReport_Id = @ID

GO

CREATE PROCEDURE dbo.IX_GetUserIdByUserNumber
@UserNumber int
AS
SELECT user_id FROM TbUserId
WHERE user_nbr = @UserNumber
GO

CREATE PROCEDURE dbo.IX_GetReportUserObjectByReportId
@pReport_id int
AS
SELECT report_id, userobject_id FROM TBReportFolder
WHERE report_id = @pReport_id
GO


CREATE PROCEDURE dbo.IX_GetTbReportByProjectId
@ProjectID int
AS
SELECT *
FROM IX_TbReports
WHERE IX_User_Nbr = @ProjectID
GO


CREATE PROCEDURE dbo.IX_GetTbReportByProjectIdAndType
@ProjectID int,
@Type varchar(2)
AS
SELECT *
FROM IX_TbReports
WHERE IX_User_Nbr = @ProjectID
AND IX_Type = @Type
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IX_GetRequestedReportByName]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[IX_GetRequestedReportByName]
GO

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO


CREATE PROCEDURE dbo.IX_GetRequestedReportByName
@ReportName varchar(255)
AS
SELECT *
FROM Tbreqreports
WHERE report_name = @ReportName

GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO


SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

CREATE PROCEDURE dbo.IX_GetUserViewList
@UserId int,
@ViewList Varchar(1000) OUTPUT
AS
BEGIN
DECLARE @UserGroups Varchar(1000)
DECLARE @GroupNo int
DECLARE @ProfileNo int
DECLARE @UserViews Varchar(1000)
DECLARE @COMMA Varchar (2)

DECLARE GroupsCursor CURSOR FOR
SELECT DISTINCT grpxref_group_nbr
FROM TbGrpxref
WHERE status_id = 1
AND grpxref_indv_nbr = @UserId

-- Initialize with the input user id
SET @UserGroups = CONVERT(VARCHAR, @UserId)

SET @COMMA = ','

-- Get group numbers for the user
OPEN GroupsCursor
FETCH NEXT FROM GroupsCursor INTO @GroupNo
--IF @@FETCH_STATUS <> 0
-- No records here

WHILE @@FETCH_STATUS = 0
BEGIN
SET @UserGroups = @UserGroups + @COMMA + CONVERT(VARCHAR, @GroupNo)
FETCH NEXT FROM GroupsCursor INTO @GroupNo
END

CLOSE GroupsCursor
DEALLOCATE GroupsCursor

-- Initialize User Views with User Groups value
SET @UserViews = @UserGroups

-- Get list of profiles for the user
DECLARE @ProfilesQuery NVarchar (1500)

SET @ProfilesQuery = 'DECLARE ProfilesCursor CURSOR FOR SELECT DISTINCT profile_nbr FROM TbUserid WHERE user_nbr IN (' + @UserGroups + ')'

EXEC sp_executesql @ProfilesQuery, N'@UserGroups Varchar(1000)', @UserGroups = @UserGroups

OPEN ProfilesCursor
FETCH NEXT FROM ProfilesCursor INTO @ProfileNo
--IF @@FETCH_STATUS <> 0
-- No records here

WHILE @@FETCH_STATUS = 0
BEGIN
SET @UserViews = @UserViews + @COMMA + CONVERT(VARCHAR, @ProfileNo)
FETCH NEXT FROM ProfilesCursor INTO @ProfileNo
END

CLOSE ProfilesCursor
DEALLOCATE ProfilesCursor

SET @ViewList = @UserViews

END




GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO



-- Procedure to get counts for Analysis jobs, when passed with a viewlist for a user
CREATE PROCEDURE dbo.IX_GetAnalysisJobsByStatusAndViewList
@ViewList Varchar (1000),
@Status Varchar (1),
@ReportTypes Varchar (100),
-- If this flag is 'Y' then the above report types are excluded, otherwise included
@ExcludeFlag Varchar(1)
AS
BEGIN
DECLARE @UserViews Varchar(1000)
DECLARE @sql nVarchar(2000)
SET @UserViews = @ViewList
-- For status values, 'N' and 'P' this sql is sufficient
SET @sql =
'SELECT report_id, report_name, report_type,
complete_flag, mode_date_time, last_run_time,
filesize, filetype
FROM TbReqReports
WHERE user_nbr IN (' + @UserViews + ')
AND complete_flag = ''' + @Status + ''''

-- This flag is to simplify the list of report types sent in ReportTypes parameter
IF @ExcludeFlag = 'Y'
SET @sql = @sql + ' AND report_type NOT IN (' + @ReportTypes + ') '
ELSE
SET @sql = @sql + ' AND report_type IN (' + @ReportTypes + ') '


IF (@Status = 'C' OR @Status = 'E')
BEGIN
SET @sql = @sql +
' AND last_run_time
BETWEEN getdate() - 3 AND getdate()'
END

IF (@Status = 'C')
SET @sql = @sql + ' ORDER BY last_run_time'
ELSE
SET @sql = @sql + ' ORDER BY mode_date_time'

--PRINT @sql
EXEC sp_executesql @sql, N'@UserViews varchar (1000), @Status varchar(1), @ReportTypes varchar(100)', @UserViews = @UserViews, @Status = @Status, @ReportTypes = @ReportTypes
END




GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO



-- Procedure to get counts for Analysis jobs
CREATE PROCEDURE dbo.IX_GetAnalysisJobsCountByStatusAndUserId
@UserId int,
@Status Varchar (1),
@ReportTypes Varchar (100),
-- If this flag is 'Y' then the above report types are excluded, otherwise included
@ExcludeFlag Varchar(1)

AS
BEGIN
DECLARE @UserViews Varchar(1000)
DECLARE @sql nVarchar(2000)

-- Get View List for User
EXEC IX_GetUserViewList @UserId, @ViewList = @UserViews OUTPUT
-- For status values, 'N' and 'P' this sql is sufficient
SET @sql =
'SELECT COUNT(*) AS JobCnt
FROM TbReqReports
WHERE user_nbr IN (' + @UserViews + ')
AND complete_flag = ''' + @Status + ''''

-- This flag is to simplify the list of report types sent in ReportTypes parameter
IF @ExcludeFlag = 'Y'
SET @sql = @sql + ' AND report_type NOT IN (' + @ReportTypes + ') '
ELSE
SET @sql = @sql + ' AND report_type IN (' + @ReportTypes + ') '

IF (@Status = 'C' OR @Status = 'E')
BEGIN
SET @sql = @sql +
' AND last_run_time
BETWEEN getdate() - 3 AND getdate()'
END

--PRINT @sql
EXEC sp_executesql @sql, N'@UserViews varchar (1000), @Status varchar(1), @ReportTypes varchar(100)', @UserViews = @UserViews, @Status = @Status, @ReportTypes = @ReportTypes
END




GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO



-- Procedure to get counts for Analysis jobs, when passed with a viewlist for a user
CREATE PROCEDURE dbo.IX_GetAnalysisJobsCountByStatusAndViewList
@ViewList Varchar (1000),
@Status Varchar (1),
@ReportTypes Varchar (100),
-- If this flag is 'Y' then the above report types are excluded, otherwise included
@ExcludeFlag Varchar(1)
AS
BEGIN
DECLARE @UserViews Varchar(1000)
DECLARE @sql nVarchar(2000)
SET @UserViews = @ViewList
-- For status values, 'N' and 'P' this sql is sufficient
SET @sql =
'SELECT COUNT(*) AS JobCnt
FROM TbReqReports
WHERE user_nbr IN (' + @UserViews + ')
AND complete_flag = ''' + @Status + ''''

-- This flag is to simplify the list of report types sent in ReportTypes parameter
IF @ExcludeFlag = 'Y'
SET @sql = @sql + ' AND report_type NOT IN (' + @ReportTypes + ') '
ELSE
SET @sql = @sql + ' AND report_type IN (' + @ReportTypes + ') '


IF (@Status = 'C' OR @Status = 'E')
BEGIN
SET @sql = @sql +
' AND last_run_time
BETWEEN getdate() - 3 AND getdate()'
END

--PRINT @sql
EXEC sp_executesql @sql, N'@UserViews varchar (1000), @Status varchar(1), @ReportTypes varchar(100)', @UserViews = @UserViews, @Status = @Status, @ReportTypes = @ReportTypes
END






GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO


-- IX_GetBatchProcessJobsByStatusAndViewList
-- The possible Mode values are the following
-- Mode = F, SubMode='UPLOAD' Means Upload Requests
-- Mode = F, SubMode='SEARCHRESULTS' Means Search Results Requests
-- Mode = O, Organize Requests
-- Mode = C, Score Calculation, Keyword Index Request
-- Mode = K, Keyword Index Request
-- Mode = D, Dynamic Analysis
-- Status can be 'N', 'P', 'C', 'E'
-- N = Pending
-- P = In Process
-- C = Completed
-- E = Error

CREATE PROCEDURE dbo.IX_GetBatchProcessJobsByStatusAndViewList
@ViewList Varchar(1000),
@Status Varchar (1),
@Mode Varchar(1),
@SubMode Varchar(20)
AS
BEGIN
DECLARE @UserViews Varchar(1000)
DECLARE @sql nVarchar(2000)
SET @UserViews = @ViewList
-- For status values, 'N' and 'P' this sql is sufficient
SET @sql =
'SELECT A.str_parameter, A.mode_date_time, A.mode, A.status,
A.last_run_time, A.searchurl, A.user_nbr_for_view,
B.user_first_name, B.user_last_name, B.group_name
FROM TbBatchProcess A , TbUserId B
WHERE A.mode = ''' + @Mode + '''
AND A.status = ''' + @Status + '''
AND A.user_nbr IN (' + @UserViews + ')
AND A.user_nbr = B.user_nbr'
IF (@Status = 'C' OR @Status = 'E')
BEGIN
SET @sql = @sql +
' AND A.last_run_time
BETWEEN getdate() - 3 AND getdate()'
END

IF (@Mode = 'F')
BEGIN
IF (@SubMode = 'UPLOAD')
BEGIN
SET @sql = @sql + ' AND A.searchurl IS NULL'
END
IF (@SubMode = 'SEARCHRESULTS')
BEGIN
SET @sql = @sql + ' AND A.searchurl IS NOT NULL'
END
END

IF (@Status = 'C')
SET @sql = @sql + ' ORDER BY A.last_run_time'
ELSE
SET @sql = @sql + ' ORDER BY A.mode_date_time'

--PRINT @sql
EXEC sp_executesql @sql, N'@UserViews varchar (1000), @Status varchar(1), @Mode Varchar(1)', @UserViews = @UserViews, @Status = @Status, @Mode=@Mode
END



GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO


-- IX_GetBatchProcessJobsCountByStatusAndUserId
-- Procedure to get counts for all the jobs from TbBatchProcess table
-- Takes UserId, Status, Mode, and Sub Mode as Input
-- The possible Mode values are the following
-- Mode = F, SubMode='UPLOAD' Means Upload Requests
-- Mode = F, SubMode='SEARCHRESULTS' Means Search Results Requests
-- Mode = O, Organize Requests
-- Mode = C, Score Calculation, Keyword Index Request
-- Mode = K, Keyword Index Request
-- Mode = D, Dynamic Analysis
-- Status can be 'N', 'P', 'C', 'E'
-- N = Pending
-- P = In Process
-- C = Completed
-- E = Error
CREATE PROCEDURE dbo.IX_GetBatchProcessJobsCountByStatusAndUserId
@UserId int,
@Status Varchar (1),
@Mode Varchar(1),
@SubMode Varchar(20)
AS
BEGIN
DECLARE @UserViews Varchar(1000)
DECLARE @sql nVarchar(2000)

-- Get View List for User
EXEC IX_GetUserViewList @UserId, @ViewList = @UserViews OUTPUT
-- For status values, 'N' and 'P' this sql is sufficient
SET @sql =
'SELECT COUNT(*) AS JobCnt
FROM TbBatchProcess A , TbUserId B
WHERE A.mode = ''' + @Mode + '''
AND A.status = ''' + @Status + '''
AND A.user_nbr IN (' + @UserViews + ')
AND A.user_nbr = B.user_nbr'
IF (@Status = 'C' OR @Status = 'E')
BEGIN
SET @sql = @sql +
' AND A.last_run_time
BETWEEN getdate() - 3 AND getdate()'
END

IF (@Mode = 'F')
BEGIN
IF (@SubMode = 'UPLOAD')
SET @sql = @sql + ' AND A.searchurl IS NULL'
IF (@SubMode = 'SEARCHRESULTS')
SET @sql = @sql + ' AND A.searchurl is NOT NULL'
END

--PRINT @sql
EXEC sp_executesql @sql, N'@UserViews varchar (1000), @Status varchar(1), @Mode Varchar(1)', @UserViews = @UserViews, @Status = @Status, @Mode=@Mode
END





GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO


-- IX_GetBatchProcessJobsCountByStatusAndViewList
CREATE PROCEDURE dbo.IX_GetBatchProcessJobsCountByStatusAndViewList
@ViewList Varchar(1000),
@Status Varchar (1),
@Mode Varchar(1),
@SubMode Varchar(20)
AS
BEGIN
DECLARE @UserViews Varchar(1000)
DECLARE @sql nVarchar(2000)
SET @UserViews = @ViewList
-- For status values, 'N' and 'P' this sql is sufficient
SET @sql =
'SELECT COUNT(*) AS JobCnt
FROM TbBatchProcess A , TbUserId B
WHERE A.mode = ''' + @Mode + '''
AND A.status = ''' + @Status + '''
AND A.user_nbr IN (' + @UserViews + ')
AND A.user_nbr = B.user_nbr'
IF (@Status = 'C' OR @Status = 'E')
BEGIN
SET @sql = @sql +
' AND A.last_run_time
BETWEEN getdate() - 3 AND getdate()'
END

IF (@Mode = 'F')
BEGIN
IF (@SubMode = 'UPLOAD')
SET @sql = @sql + ' AND A.searchurl IS NULL'
IF (@SubMode = 'SEARCHRESULTS')
SET @sql = @sql + ' AND A.searchurl IS NOT NULL'
END

--PRINT @sql
EXEC sp_executesql @sql, N'@UserViews varchar (1000), @Status varchar(1), @Mode Varchar(1)', @UserViews = @UserViews, @Status = @Status, @Mode=@Mode
END



GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO




CREATE PROCEDURE dbo.IX_GetLanSyncJobsByStatusAndViewList
@ViewList Varchar(1000),
@Status Varchar(1)
AS
BEGIN
DECLARE @UserViews Varchar(1000)
DECLARE @sql nVarchar(2000)
SET @UserViews = @ViewList
SET @sql =
'SELECT A.dir_name, B.request_time, B.complete_time,
B.sync_status_text, C.user_first_name,
C.user_last_name, C.group_name
FROM TbDirectory A, TbDirxUser B, TbUserid C
WHERE A.dir_nbr = B.dir_nbr
AND B.user_nbr IN (' + @UserViews + ')
AND B.user_nbr = C.user_nbr
AND B.sync_status_text = ''' + @Status + ''''

IF (@Status = 'C' OR @Status = 'E')
BEGIN
SET @sql = @sql +
' AND B.complete_time
BETWEEN getdate() - 3 AND getdate()'
END
IF (@Status = 'C')
SET @sql = @sql + ' ORDER BY B.complete_time DESC'
ELSE
SET @sql = @sql + ' ORDER BY B.request_time DESC'


EXEC sp_executesql @sql, N'@UserViews varchar (1000), @Status varchar(1)', @UserViews = @UserViews, @Status = @Status
END






GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO



CREATE PROCEDURE dbo.IX_GetLanSyncJobsCountByStatusAndViewList
@ViewList Varchar(1000),
@Status Varchar(1)
AS
BEGIN
DECLARE @UserViews Varchar(1000)
DECLARE @sql nVarchar(2000)
SET @UserViews = @ViewList
SET @sql =
'SELECT COUNT(*) AS JobCnt
FROM TbDirectory A, TbDirxUser B, TbUserid C
WHERE A.dir_nbr = B.dir_nbr
AND B.user_nbr IN (' + @UserViews + ')
AND B.user_nbr = C.user_nbr
AND B.sync_status_text = ''' + @Status + ''''

IF (@Status = 'C' OR @Status = 'E')
BEGIN
SET @sql = @sql +
' AND B.complete_time
BETWEEN getdate() - 3 AND getdate()'
END
EXEC sp_executesql @sql, N'@UserViews varchar (1000), @Status varchar(1)', @UserViews = @UserViews, @Status = @Status
END




GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO



CREATE PROCEDURE dbo.IX_GetLanSyncJobsDetails
@ViewList Varchar (1000)
AS
SELECT A.dir_name, B.complete_time, C.user_first_name, C.user_last_name, C.group_name
FROM TbDirectory A, TbDirxUser B, TbUserid C
WHERE A.dir_nbr = B.dir_nbr
AND B.user_nbr
IN (@ViewList)
AND B.user_nbr = C.user_nbr
AND B.sync_status_text = 'C'
AND B.complete_time
BETWEEN getdate() - 3 AND getdate()
ORDER BY B.complete_time DESC




GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO




-- Procedure to get Publish jobs
CREATE PROCEDURE dbo.IX_GetPublishJobsByStatusAndViewList
@ViewList Varchar(1000),
@Status Varchar (1)
AS
BEGIN
DECLARE @UserViews Varchar(1000)
DECLARE @sql nVarchar(2000)
SET @UserViews = @ViewList
-- For status values, 'N' and 'P' this sql is sufficient
SET @sql =
'SELECT DISTINCT A.userobject_id, B.Update_req_time,
B.Update_complete_time, B.update_complete_flag,
C.description, D.user_first_name,
D.user_last_name, D.group_name, E.group_name
FROM TBPublish A, TBPubReq B, TBUserObject C, TbUserId D,
TbUserId E, TbUserObject F
WHERE C.object_type = ''F''
AND C.userobject_id = A.userobject_id
AND C.user_nbr IN (' + @UserViews + ')
AND B.userobject_id = F.userobject_id
AND F.parent_id = c.userobject_id
AND F.object_id <> 0
AND D.user_nbr = C.user_nbr
AND E.user_nbr = A.To_User_Group_Nbr
AND B.update_complete_flag = ''' + @Status + ''''
IF (@Status = 'C' OR @Status = 'E')
BEGIN
SET @sql = @sql +
' AND B.Update_complete_time
BETWEEN getdate() - 3 AND getdate()'
END

IF (@Status = 'C')
SET @sql = @sql + ' ORDER BY B.Update_complete_time'
ELSE
SET @sql = @sql + ' ORDER BY B.Update_req_time'

--PRINT @sql
EXEC sp_executesql @sql, N'@UserViews varchar (1000), @Status varchar(1)', @UserViews = @UserViews, @Status = @Status
END




GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO

-- Procedure to get counts for Publish jobs
CREATE PROCEDURE dbo.IX_GetPublishJobsCountByStatusAndUserId
@UserId int,
@Status Varchar (1),
@JobCnt int OUTPUT

AS
BEGIN
DECLARE @UserViews Varchar(1000)
DECLARE @sql nVarchar(2000)

-- Get View List for User
EXEC IX_GetUserViewList @UserId, @ViewList = @UserViews OUTPUT
-- For status values, 'N' and 'P' this sql is sufficient
SET @sql =
'SELECT DISTINCT A.userobject_id, B.Update_req_time,
B.Update_complete_time, B.update_complete_flag,
C.description, D.user_first_name,
D.user_last_name, D.group_name, E.group_name
FROM TBPublish A, TBPubReq B, TBUserObject C, TbUserId D,
TbUserId E, TbUserObject F
WHERE C.object_type = ''F''
AND C.userobject_id = A.userobject_id
AND C.user_nbr IN (' + @UserViews + ')
AND B.userobject_id = F.userobject_id
AND F.parent_id = c.userobject_id
AND F.object_id <> 0
AND D.user_nbr = C.user_nbr
AND E.user_nbr = A.To_User_Group_Nbr
AND B.update_complete_flag = ''' + @Status + ''''
IF (@Status = 'C' OR @Status = 'E')
BEGIN
SET @sql = @sql +
' AND B.Update_complete_time
BETWEEN getdate() - 3 AND getdate()'
END

--PRINT @sql
EXEC sp_executesql @sql, N'@UserViews varchar (1000), @Status varchar(1)', @UserViews = @UserViews, @Status = @Status
SET @JobCnt = @@ROWCOUNT
END


GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO

-- Procedure to get counts for Publish jobs
CREATE PROCEDURE dbo.IX_GetPublishJobsCountByStatusAndViewList
@ViewList Varchar(1000),
@Status Varchar (1),
@JobCnt int OUTPUT
AS
BEGIN
DECLARE @UserViews Varchar(1000)
DECLARE @sql nVarchar(2000)

SET @UserViews = @ViewList
-- For status values, 'N' and 'P' this sql is sufficient
SET @sql =
'SELECT DISTINCT A.userobject_id, B.Update_req_time,
B.Update_complete_time, B.update_complete_flag,
C.description, D.user_first_name,
D.user_last_name, D.group_name, E.group_name
FROM TBPublish A, TBPubReq B, TBUserObject C, TbUserId D,
TbUserId E, TbUserObject F
WHERE C.object_type = ''F''
AND C.userobject_id = A.userobject_id
AND C.user_nbr IN (' + @UserViews + ')
AND B.userobject_id = F.userobject_id
AND F.parent_id = c.userobject_id
AND F.object_id <> 0
AND D.user_nbr = C.user_nbr
AND E.user_nbr = A.To_User_Group_Nbr
AND B.update_complete_flag = ''' + @Status + ''''
IF (@Status = 'C' OR @Status = 'E')
BEGIN
SET @sql = @sql +
' AND B.Update_complete_time
BETWEEN getdate() - 3 AND getdate()'
END

--PRINT @sql
EXEC sp_executesql @sql, N'@UserViews varchar (1000), @Status varchar(1)', @UserViews = @UserViews, @Status = @Status
SET @JobCnt = @@ROWCOUNT
END


GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

CREATE PROCEDURE IX_GetDocumentImportance (

@pIX_DocumentID bigint

)

AS

select IX_Importance
from IX_Documents
where IX_DocumentID = @pIX_DocumentID
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO


CREATE PROCEDURE IX_GetAllFolders
(
@pIX_ViewID bigint
)
AS
SELECT * FROM IX_Folders where IX_ViewID = @pIX_ViewID
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO


CREATE PROCEDURE IX_GetAllKeywordConcepts
AS
SELECT * FROM IX_Concepts WHERE IX_TYPE='K' and IX_CODE != 'N'
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO

CREATE PROCEDURE IX_GetAllOntologies
AS
SELECT C.IX_ConceptId, CE.IX_ConceptExpressionId, C.IX_Name, C.IX_CreationDate, C.IX_Description
FROM IX_Concepts C, IX_ConceptExpressions CE
WHERE C.IX_ConceptId = CE.IX_ConceptId
AND C.IX_Type = 'RO'
AND CE.IX_Type = 'RO'
GO


SET QUOTED_IDENTIFIER OFF
GO

SET ANSI_NULLS ON
GO

-------------------------------------

CREATE PROCEDURE IX_GetAllProjects
AS
SELECT *
FROM IX_Projects

GO

-------------------------------------

CREATE PROCEDURE dbo.IX_GetAllRequestMessages
AS
SELECT * FROM IX_QueueMessages
WHERE IX_Status != 'C'
AND IX_Queue = 'R'
ORDER BY IX_PriorityType, IX_Priority, IX_CreationDate
GO








SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO


CREATE PROCEDURE IX_GetAllViewConcepts

AS
select * from IX_ViewConcepts
RETURN

GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

-------------------------------------------------- ---

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO


CREATE PROCEDURE IX_GetAllViews

AS
select * from IX_Views

GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

-------------------------------------------------- ---

CREATE PROCEDURE dbo.IX_GetAllViewsByProjectId
@ProjectId bigint
AS
SELECT * FROM IX_Views
WHERE IX_ProjectId = @ProjectId
GO

-------------------------------------------------- ---

CREATE PROCEDURE dbo.IX_GetBatchJobsByParentId
@ParentId bigint
AS
SELECT TOP 100 * FROM IX_QueueMessages
WHERE IX_Status = 'U'
AND IX_ParentId = @ParentId
AND IX_Queue = 'P'
GO

-------------------------------------------------- --

CREATE PROCEDURE IX_GetConcept
@Name varchar(500),
@Type varchar(10)
AS
SELECT *
FROM IX_Concepts
WHERE IX_Name = @Name
AND IX_Type = @Type
GO

-------------------------------------------------- --

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO

CREATE PROCEDURE IX_GetConceptID

@pIX_Name varchar(500),
@pIX_Type varchar(10)


AS

SELECT IX_ConceptID, IX_Importance FROM IX_Concepts WHERE IX_Name = @pIX_Name AND IX_Type = @pIX_Type
RETURN

GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

----------------------------------------------

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO

CREATE PROCEDURE IX_GetConceptIdByViewId

(
@pIX_ViewID bigint

)

AS
SELECT IX_ConceptID FROM IX_ViewConcepts WHERE IX_ViewID = @pIX_ViewID
RETURN

GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO

CREATE PROCEDURE IX_GetConceptExpressionID

(
@pIX_ConceptID bigint,
@pIX_Operand1 bigint,
@pIX_Type varchar(10)
)

AS

SELECT IX_ConceptExpressionID FROM IX_ConceptExpressions WHERE IX_ConceptID =@pIX_ConceptID AND IX_Operand1 = @pIX_Operand1 AND IX_Type = @pIX_Type

GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO

CREATE PROCEDURE IX_GetConceptsByViewID

(
@pIX_ViewID bigint

)

AS
select * from IX_Concepts where IX_ConceptID In(
select IX_ConceptID
from IX_ViewConcepts
where IX_ViewID = @pIX_ViewID
)

GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO

CREATE PROCEDURE dbo.IX_GetFolderById
(
@pIX_FolderId bigint,
@pIX_ViewID bigint
)

AS
select * from IX_Folders where IX_FolderID = @pIX_FolderID and IX_ViewID = @pIX_ViewID

GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO

CREATE PROCEDURE dbo.IX_GetFolderByName
(
@pIX_Name varchar(500),
@pIX_ViewID bigint

)

AS
select * from IX_Folders where IX_Name = @pIX_Name and IX_ViewID = @pIX_ViewID



GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO

CREATE PROCEDURE IX_GetFolderConceptID

@pIX_FolderID bigint,
@pIX_ConceptID bigint

AS
SELECT IX_FolderConceptID FROM IX_FolderConcepts WHERE IX_FolderID = @pIX_FolderID AND IX_ConceptID = @pIX_ConceptID

RETURN

GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

--------------------------------------

CREATE PROCEDURE dbo.IX_GetNextRequestMessageIdForProcessingByCompo nent
@Component varchar (5)
AS
SELECT TOP 1 * FROM IX_QueueMessages
WHERE IX_Status = 'IP'
AND IX_Queue = 'R'
AND IX_Component = @Component
ORDER BY IX_PriorityType, IX_Priority, IX_CreationDate
GO

-----------------------------------

CREATE PROCEDURE dbo.IX_GetProjectById
@ProjectId bigint
AS
SELECT *
FROM IX_Projects
WHERE IX_ProjectId = @ProjectId
GO
-----------------------------------


SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO

CREATE PROCEDURE dbo.IX_GetQueueMessageById
@ID bigint
AS
SELECT *
FROM IX_QueueMessages
WHERE IX_Id = @ID
GO

CREATE PROCEDURE IX_GetReplacementID

(
@pIX_ConceptID bigint,
@pIX_ViewID bigint
)

AS
SELECT IX_ReplacementID FROM IX_ViewConcepts WHERE IX_ConceptID = @pIX_ConceptID and IX_ViewID = @pIX_ViewID
RETURN

GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO



SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO

CREATE PROCEDURE IX_GetView
(
@Name varchar(500),
@ProjectId bigint,
@Type varchar(500)
)

AS
SELECT IX_ViewId FROM IX_Views
WHERE IX_Name = @Name
AND IX_ProjectId = @ProjectId
AND IX_Type = @Type

GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO





SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO

CREATE PROCEDURE IX_GetViewById

(
@ViewId bigint
)

AS
SELECT * FROM IX_Views
WHERE IX_ViewID = @ViewId

GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO


SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO

CREATE PROCEDURE IX_InsertConcept (

@pIX_Name varchar(500),
@pIX_Type varchar(10),
@pIX_Importance int,
@pIX_Description varchar(500),
@pIX_Status varchar(10),
@pIX_CreationDate datetime,
@pIX_LastUpdateDate datetime,
@pIX_CreatedBycode varchar(500),
@pIX_Code varchar(500),
@pIX_ContextID bigint,
@pIX_ConceptID bigint output

)
AS

insert into IX_Concepts ( IX_Name, IX_Type, IX_Importance, IX_Description, IX_Status,
IX_CreationDate,IX_LastUpdateDate, IX_CreatedByCode, IX_Code, IX_ContextID)

values (@pIX_Name, @pIX_Type, @pIX_Importance, @pIX_Description, @pIX_Status,
@pIX_CreationDate, @pIX_LastUpdateDate, @pIX_CreatedByCode, @pIX_Code, @pIX_ContextID)


SET @pIX_ConceptID = @@IDENTITY
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO

CREATE PROCEDURE IX_InsertConceptExpression

(

@pIX_ConceptID bigint,
@pIX_Operand1 bigint,
@pIX_Operand2 bigint,
@pIX_Operand3 bigint,
@pIX_Operator varchar(500),
@pIX_Data varchar(500),
@pIX_Effect varchar(500),
@pIX_Group varchar(500),
@pIX_Type varchar(10),
@pIX_Importance int,
@pIX_Order int,
@pIX_Status varchar(10),
@pIX_CreationDate datetime,
@pIX_LastUpdateDate datetime,
@pIX_Name varchar(500),
@pIX_Description varchar(500),
@pIX_OntologyID bigint,
@pIX_ContextID bigint,
@pIX_DisplayName varchar(500),
@pIX_SortName varchar(500),
@pIX_XSL text,
@pIX_Operand1Extensions varchar(500),
@pIX_Operand2Extensions varchar(500),
@pIX_Operand3Extensions varchar(500),
@pIX_ConceptExpressionID bigint output

)

AS
insert into IX_ConceptExpressions ( IX_ConceptID, IX_Operand1, IX_Operand2, IX_Operand3, IX_Operator,
IX_Data, IX_Effect, IX_Group, IX_Type, IX_Importance, IX_Order, IX_Status,
IX_CreationDate, IX_LastUpdateDate, IX_Name, IX_Description,
IX_OntologyID, IX_ContextID, IX_DisplayName, IX_SortName,
IX_Control,
IX_Operand1Extensions, IX_Operand2Extensions, IX_Operand3Extensions)

values (@pIX_ConceptID, @pIX_Operand1, @pIX_Operand2, @pIX_Operand3, @pIX_Operator, @pIX_Data, @pIX_Effect,
@pIX_Group, @pIX_Type, @pIX_Importance, @pIX_Order, @pIX_Status, @pIX_CreationDate, @pIX_LastUpdateDate,
@pIX_Name, @pIX_Description,
@pIX_OntologyID, @pIX_ContextID, @pIX_DisplayName, @pIX_SortName,
@pIX_XSL, @pIX_Operand1Extensions, @pIX_Operand2Extensions,
@pIX_Operand3Extensions)

SET @pIX_ConceptExpressionID = @@IDENTITY
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS OFF
GO

CREATE PROCEDURE IX_InsertDocument (

@pIX_Name varchar(400),
@pIX_Path varchar(500) ,
@pIX_NumberOfWords int,
@pIX_Type varchar(10) ,
@pIX_Importance int,
@pIX_CreationDate datetime,
@pIX_LastUpdateDate datetime,
@pIX_Status varchar(10),
@pIX_Description varchar(500),
@pIX_SizeKB int,
@pIX_LastAccessedDate datetime,
@pIX_Size int ,
@pIX_Checksum bigint,
@pIX_CompressedIndex binary(500),
@pIX_EventURL varchar(500),
@pIX_EventConcept int,
@pIX_VersionNumber int,
@pIX_DocumentID bigint output
)
AS

insert into IX_Documents ( IX_Name, IX_Path, IX_NumberOfWords, IX_Type, IX_Importance, IX_CreationDate,
IX_LastUpdateDate, IX_Status, IX_Description, IX_SizeKB, IX_LastAccessedDate,
IX_Size, IX_Checksum, IX_CompressedIndex, IX_EventURL, IX_EventConcept,
IX_VersionNumber )
values ( @pIX_Name, @pIX_Path, @pIX_NumberOfWords, @pIX_Type, @pIX_Importance, @pIX_CreationDate,
@pIX_LastUpdateDate, @pIX_Status, @pIX_Description, @pIX_SizeKB, @pIX_LastAccessedDate ,
@pIX_Size, @pIX_Checksum, @pIX_CompressedIndex, @pIX_EventURL, @pIX_EventConcept,
@pIX_VersionNumber )

set @pIX_DocumentID = @@IDENTITY
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO

CREATE PROCEDURE IX_InsertDocumentConcept

@pIX_DocumentID bigint,
@pIX_ParagraphNumber int,
@pIX_Code bigint,
@pIX_NumberOfHits int,
@pIX_Importance int,
@pIX_FolderConceptID bigint,
@pIX_Type varchar(10),
@pIX_Status varchar(10),
@pIX_CreationDate DateTime,
@pIX_LastUpdateDate DateTime,
@pIX_Ranking int,
@pIX_TemporalDate DateTime,
@pIX_ClosestMatch int,
@pIX_DocumentConceptID bigint output

AS
INSERT INTO IX_DocumentConcepts ( IX_DocumentID, IX_ParagraphNumber, IX_Code, IX_NumberOfHits, IX_Importance,
IX_FolderConceptID, IX_Type, IX_Status, IX_CreationDate,
IX_LastUpdateDate, IX_Ranking, IX_TemporalDate, IX_ClosestMatch )

VALUES( @pIX_DocumentID, @pIX_ParagraphNumber, @pIX_Code, @pIX_NumberOfHits, @pIX_Importance,
@pIX_FolderConceptID, @pIX_Type, @pIX_Status, @pIX_CreationDate,
@pIX_LastUpdateDate, @pIX_Ranking, @pIX_TemporalDate, @PIX_ClosestMatch )

SET @pIX_DocumentConceptID = @@IDENTITY

RETURN

GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO

CREATE PROCEDURE IX_InsertDocumentFolder(

@pIX_DocumentID bigint,
@pIX_Status varchar(10),
@pIX_FolderID bigint,
@pIX_Type varchar(10),
@pIX_CreationDate datetime,
@pIX_LastUpdateDate datetime,
@pIX_DisplayCode varchar(500),
@pIX_FolderScore int,
@pIX_TemporalDate datetime,
@pIX_DocumentFolderID bigint output

)
AS
insert into IX_DocumentFolders ( IX_DocumentID, IX_Status, IX_FolderID, IX_Type,
IX_Creationdate, IX_LastUpdateDate, IX_DisplayCode,
IX_FolderScore, IX_TemporalDate)
values ( @pIX_DocumentID, @pIX_Status, @pIX_FolderID, @pIX_Type, @pIX_CreationDate,
@pIX_LastUpdateDate, @pIX_DisplayCode, @pIX_FolderScore, @pIX_TemporalDate )

set @pIX_DocumentFolderID = @@IDENTITY
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO

CREATE PROCEDURE IX_InsertDocumentKeyword
(


@pIX_DocumentID bigint,
@pIX_NumberOfHits int,
@pIX_Type varchar(10),
@pIX_Status varchar(10),
@pIX_ConceptID bigint,
@pIX_Importance varchar(500),
@pIX_CreationDate datetime,
@pIX_LastUpdateDate datetime,
@pIX_Sense bigint,
@pIX_DocumentKeywordID bigint output


)
AS
/*
SELECT @pIX_DocumentKeywordID = IX_DocumentKeywordID FROM IX_DocumentKeywords
WHERE IX_DocumentID = @pIX_DocumentID and IX_ConceptID = @pIX_ConceptID

if @pIX_DocumentKeywordID is not null
begin
UPDATE IX_DocumentKeywords SET IX_Importance = IX_Importance + @pIX_Importance , IX_NumberOfHits = IX_NumberOfHits + @pIX_NumberOfHits
WHERE IX_DocumentID = @pIX_DocumentID and IX_ConceptID = @pIX_ConceptID
end
else
*/

insert into IX_DocumentKeywords ( IX_DocumentID, IX_NumberOfHits, IX_Type, IX_Status, IX_CreationDate,
IX_LastUpdateDate, IX_ConceptID, IX_Importance, IX_Sense)
values ( @pIX_DocumentID, @pIX_NumberOfHits, @pIX_Type, @pIX_Status, @pIX_CreationDate,
@pIX_LastUpdateDate, @pIX_ConceptID, @pIX_Importance, @pIX_Sense)

set @pIX_DocumentKeywordID = @@IDENTITY

GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO

CREATE PROCEDURE IX_InsertDocumentWordOrder
(

@pIX_WordOrder int,
@pIX_DocumentKeywordID bigint,
@pIX_Type varchar(10),
@pIX_Status varchar(10),
@pIX_CreationDate datetime,
@pIX_LastUpdateDate datetime,
@pIX_SentenceNumber int,
@pIX_SentencePosition int,
@pIX_ParagraphNumber int,
@pIX_PageNumber int,
@pIX_DocumentWordOrderID bigint output

)
AS
insert into IX_DocumentWordOrders ( IX_WordOrder, IX_DocumentKeywordID, IX_Type, IX_Status,
IX_Creationdate, IX_LastUpdateDate, IX_SentenceNumber,
IX_SentencePosition, IX_ParagraphNumber, IX_PageNumber)
values ( @pIX_WordOrder, @pIX_DocumentKeywordID, @pIX_Type, @pIX_Status, @pIX_CreationDate,
@pIX_LastUpdateDate, @pIX_SentenceNumber,
@pIX_SentencePosition, @pIX_ParagraphNumber, @pIX_PageNumber )

set @pIX_DocumentWordOrderID = @@IDENTITY

GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO

CREATE PROCEDURE IX_InsertFolder
(

@pIX_ViewID bigint,
@pIX_DocumentCount int,
@pIX_TotalImportance int,
@pIX_TotalWords int,
@pIX_VersionNumber int,
@pIX_Type varchar(10),
@pIX_ParentFolderID bigint,
@pIX_Status varchar(10),
@pIX_CreationDate datetime,
@pIX_LastUpdateDate datetime,
@pIX_Name varchar(500),
@pIX_Description varchar(500),
@pIX_Comments varchar(500),
@pIX_ScoreSize int,
@pIX_CompressedArchive binary(500),
@pIX_SnapshotTime int,
@pIX_EventURL varchar(500),
@pIX_EventConcept int,
@pIX_Importance int,
@pIX_FolderID bigint output

)
AS
insert into IX_Folders ( IX_ViewID, IX_DocumentCount, IX_TotalImportance,
IX_TotalWords, IX_VersionNumber, IX_Type,
IX_ParentFolderID, IX_Status, IX_CreationDate, IX_LastUpdateDate,
IX_Name, IX_Description, IX_Comments, IX_ScoreSize, IX_CompressedArchive,
IX_SnapshotTime, IX_EventURL, IX_EventConcept, IX_Importance)
values ( @pIX_ViewID, @pIX_DocumentCount, @pIX_TotalImportance, @pIX_TotalWords,
@pIX_VersionNumber, @pIX_Type, @pIX_ParentFolderID, @pIX_Status, @pIX_CreationDate,
@pIX_LastUpdateDate, @pIX_Name, @pIX_Description, @pIX_Comments, @pIX_ScoreSize,
@pIX_CompressedArchive, @pIX_SnapshotTime, @pIX_EventURL, @pIX_EventConcept, @pIX_Importance)

set @pIX_FolderID = @@IDENTITY
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO

CREATE PROCEDURE IX_InsertFolderConcept (

@pIX_NumberOfHits bigint,
@pIX_Importance bigint,
@pIX_Name varchar(500),
@pIX_NumberOfDocuments int,
@pIX_Type varchar(10),
@pIX_FolderID bigint,
@pIX_Valid varchar(500),
@pIX_VersionNumber int,
@pIX_Active varchar(500),
@pIX_ConceptID bigint,
@pIX_Status varchar(10),
@pIX_CreationDate datetime,
@pIX_LastUpdateDate datetime,
@pIX_Ranking int,
@pIX_ClosestMatch int,
@pIX_Processed int,
@pIX_LastAccessedDate datetime,
@pIX_NeedsProcessing varchar(500),
@pIX_FolderConceptID bigint output

)
AS
insert into IX_FolderConcepts ( IX_NumberOfHits, IX_Importance, IX_Name, IX_NumberOfDocuments, IX_Type,
IX_FolderID, IX_Valid, IX_VersionNumber, IX_Active, IX_ConceptID, IX_Status,
IX_CreationDate, IX_LastUpdateDate, IX_Ranking, IX_ClosestMatch, IX_Processed,
IX_LastAccessedDate, IX_NeedsProcessing)

values ( @pIX_NumberOfHits, @pIX_Importance, @pIX_Name, @pIX_NumberOfDocuments,
@pIX_Type, @pIX_FolderID, @pIX_Valid, @pIX_VersionNumber, @pIX_Active,
@pIX_ConceptID, @pIX_Status, @pIX_CreationDate, @pIX_LastUpdateDate,
@pIX_Ranking, @pIX_ClosestMatch, @pIX_Processed, @pIX_LastAccessedDate, @pIX_NeedsProcessing)

SET @pIX_FolderConceptID = @@IDENTITY

GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

-----------------------------------------------

CREATE PROCEDURE IX_InsertProject
(
@Name varchar(500),
@ClientId bigint,
@Type varchar(10),
@Status varchar(10),
@ProjectId bigint output
)

AS
INSERT INTO IX_Projects
(
IX_Name,
IX_ClientId,
IX_Type,
IX_Status,
IX_CreationDate,
IX_LastUpdateDate
)
VALUES
(
@Name,
@ClientId,
@Type,
@Status,
GetDate(),
GetDate()
)
SET @ProjectId = @@IDENTITY

GO

-----------------------------------------------

CREATE PROCEDURE dbo.IX_InsertQueueMessage
@ParentId bigint,
@Data text,
@Type varchar(2),
@UserId bigint,
@ProjectId bigint,
@Name varchar(1000),
@Priority tinyint,
@PriorityType tinyint,
@Component varchar(5),
@Status varchar(2),
@TotalTasks int,
@TasksRemaining int,
@Queue varchar(2),
@LastOwner varchar(260),
@Revision varchar(20),
@Id bigint OUTPUT
AS
INSERT INTO IX_QueueMessages (
IX_ParentId,
IX_CreationDate,
IX_Data,
IX_Type,
IX_UserId,
IX_ProjectId,
IX_Name,
IX_Priority,
IX_PriorityType,
IX_Component,
IX_Status,
IX_LastUpdated,
IX_TotalTasks,
IX_TasksRemaining,
IX_Queue,
IX_LastOwner,
IX_Revision )
VALUES (
@ParentId,
GetDate(),
@Data,
@Type,
@UserId,
@ProjectId,
@Name,
@Priority,
@PriorityType,
@Component,
@Status,
GetDate(),
@TotalTasks,
@TasksRemaining,
@Queue,
@LastOwner,
@Revision)
SET @Id = @@IDENTITY
GO

----------------------------------------------

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO

CREATE PROCEDURE IX_InsertView
(
@Name varchar(500),
@ProjectId bigint,
@Type varchar(10),
@Status varchar(10),
@ViewId bigint output
)

AS
INSERT INTO IX_Views
(
IX_Name,
IX_ProjectId,
IX_Type,
IX_Status,
IX_CreationDate,
IX_LastUpdateDate
)
VALUES
(
@Name,
@ProjectId,
@Type,
@Status,
GetDate(),
GetDate()
)
SET @ViewId = @@IDENTITY

GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO


SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO

CREATE PROCEDURE IX_InsertViewConcept
(
@pIX_ViewID bigint,
@pIX_ConceptID bigint,
@pIX_Type varchar(10),
@pIX_Status varchar(10),
@pIX_CreationDate datetime,
@pIX_LastUpdateDate datetime,
@pIX_ReplacementID bigint,
@pIX_Importance int,
@pIX_SenseID bigint,
@pIX_SenseStrength int,
@pIX_ViewConceptID bigint output
)

AS

insert into IX_ViewConcepts ( IX_ViewID, IX_ConceptID, IX_Type, IX_Status,
IX_CreationDate,IX_LastUpdateDate, IX_ReplacementID,
IX_Importance, IX_SenseID, IX_SenseStrength)

values (@pIX_ViewID, @pIX_ConceptID, @pIX_Type, @pIX_Status,
@pIX_CreationDate, @pIX_LastUpdateDate, @pIX_ReplacementID, @pIX_Importance,
@pIX_SenseID, @pIX_SenseStrength)


SET @pIX_ViewConceptID = @@IDENTITY
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO

CREATE PROCEDURE IX_UpdateDocumentImportance

@pIX_DocumentID bigint,
@pIX_Importance int,
@pIX_Size int

AS
UPDATE IX_Documents SET IX_Importance = @pIX_Importance, IX_Size = @pIX_Size, IX_LastUpdateDate = GetDate()
WHERE IX_DocumentID = @pIX_DocumentID
RETURN

GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO


CREATE PROCEDURE IX_UpdateFolder
@pIX_FolderID bigint,
@pIX_DocumentCount int,
@pIX_TotalWords int,
@pIX_TotalImportance int,
@pIX_LastUpdateDate datetime

AS
UPDATE IX_Folders
SET
IX_DocumentCount = IX_DocumentCount + @pIX_DocumentCount,
IX_TotalWords = IX_TotalWords + @pIX_TotalWords,
IX_TotalImportance = IX_TotalImportance + @pIX_TotalImportance,
IX_LastUpdateDate = @pIX_LastUpdateDate,
IX_VersionNumber = IX_VersionNumber + 1
WHERE IX_FolderID = @pIX_FolderID
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO

CREATE PROCEDURE IX_UpdateFolderConcept

@pIX_FolderConceptID bigint,
@pIX_NumberOfHits bigint,
@pIX_NumberOfDocuments bigint,
@pIX_Importance bigint

AS

UPDATE IX_FolderConcepts
SET
IX_NumberOfHits = IX_NumberOfHits + @pIX_NumberOfHits,
IX_NumberOfDocuments = IX_NumberOfDocuments + @pIX_NumberOfDocuments,
IX_Importance = IX_Importance + @pIX_Importance,
IX_VersionNumber = IX_VersionNumber + 1,
IX_LastUpdateDate = GetDate()
WHERE IX_FolderConceptID = @pIX_FolderConceptID
RETURN

GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

CREATE PROCEDURE dbo.IX_UpdateQueueMessageById
@Id bigint,
@ParentID bigint,
@Data text,
@Type varchar(2),
@UserId bigint,
@ProjectId bigint,
@Name varchar(500),
@Priority tinyint,
@PriorityType tinyint,
@Component varchar (5),
@Status varchar (2),
@TotalTasks int,
@TasksRemaining int,
@LastOwner varchar (260),
@Revision varchar (20),
@Queue varchar (2)

AS
UPDATE IX_QueueMessages
SET
IX_ParentId = @ParentID,
IX_Data = @Data,
IX_Type = @Type,
IX_UserId = @UserId,
IX_ProjectId = @ProjectId,
IX_Name = @Name,
IX_Priority = @Priority,
IX_PriorityType = @PriorityType,
IX_Component = @Component,
IX_Status = @Status,
IX_TotalTasks = @TotalTasks,
IX_TasksRemaining = @TasksRemaining,
IX_Queue = @Queue,
IX_LastOwner = @LastOwner,
IX_Revision = @Revision,
IX_LastUpdated = GetDate()
WHERE IX_Id = @Id
GO

CREATE PROCEDURE dbo.IX_UpdateRequestMessageForProcessingById
@ID bigint,
@Status varchar(2),
@TotalTasks int,
@TasksRemaining int
AS
UPDATE IX_QueueMessages
SET IX_Status = @Status,
IX_TotalTasks = @TotalTasks,
IX_TasksRemaining = @TasksRemaining,
IX_LastUpdated = GetDate()
WHERE IX_Id = @ID
GO


CREATE PROCEDURE dbo.IX_UpdateStatusForBatchingByID
@ID bigint,
@LastOwner varchar(260)
AS
UPDATE IX_QueueMessages
SET IX_Status = 'B',
IX_LastOwner = @LastOwner,
IX_LastUpdated = GetDate()
WHERE IX_Id = @ID
AND IX_Status = 'U'
GO


CREATE PROCEDURE dbo.IX_UpdateStatusForProcessingById
@Id bigint,
@LastOwner varchar (260)
AS
UPDATE IX_QueueMessages
SET IX_Status = 'IP',
IX_LastOwner = @LastOwner,
IX_LastUpdated = GetDate()
WHERE IX_Id = @Id
AND IX_Status = 'U'
GO

CREATE PROCEDURE dbo.IX_UpdateTasksRemainingById
@Id bigint
AS
UPDATE IX_QueueMessages
SET IX_TasksRemaining = (IX_TasksRemaining - 1),
IX_LastUpdated = GetDate()
WHERE IX_Id = @Id
GO


CREATE PROCEDURE dbo.IX_DeleteOntologiesByConceptIdList(
@IdList varchar (3500)
)
AS
DECLARE @sql nvarchar(3600)
SET @sql = 'DELETE FROM IX_Concepts c, IX_ConceptExpressions e' +
'WHERE c.IX_ConceptID IN (' + @IdList + ') AND e.IX_ConceptID = (' + @IdList + ')'
EXEC sp_executesql @sql, N'@IdList varchar (3500)', @IdList = @IdList
GO


CREATE PROCEDURE IX_InsertOntology(
@CName nvarchar(400),
@CType varchar(10),
@CImportance int,
@CDescription varchar(500),
@CStatus varchar(10),
@CCreatedByCode varchar(500),
@CCode varchar(500),
@ContextID bigint,

@CEOperand1 bigint,
@CEOperand2 bigint,
@CEOperand3 bigint,
@CEOperator varchar(500),
@CEData varchar(500),
@CEEffect varchar(500),
@CEGroup varchar(500),
@CEType varchar(10),
@CEImportance int,
@CEOrder int,
@CEStatus varchar(10),
@CEName varchar(500),
@CEDescription varchar(500),
@CEOntologyID bigint,
@CEDisplayName varchar(500),
@CESortName varchar(500),
@CEXsl text,
@CEOperand1Extensions varchar(500),
@CEOperand2Extensions varchar(500),
@CEOperand3Extensions varchar(500),

@ConceptID bigint output,
@ConceptExpressionID bigint output
)
AS
begin
insert into IX_Concepts (
IX_Name, IX_Type, IX_Importance,
IX_Description, IX_Status, IX_CreationDate, IX_LastUpdateDate,
IX_CreatedByCode, IX_Code, IX_ContextID )

values (@CName, @CType, @CImportance,
@CDescription, @CStatus, getDate(), getDate(),
@CCreatedByCode, @CCode, @ContextID)

set @ConceptID = @@IDENTITY

insert into IX_ConceptExpressions (
IX_ConceptID, IX_Operand1, IX_Operand2, IX_Operand3, IX_Operator,
IX_Data, IX_Effect, IX_Group, IX_Type, IX_Importance, IX_Order, IX_Status,
IX_CreationDate, IX_LastUpdateDate, IX_Name, IX_Description,
IX_OntologyID, IX_ContextID, IX_DisplayName, IX_SortName, IX_Control,
IX_Operand1Extensions, IX_Operand2Extensions, IX_Operand3Extensions )

values (@ConceptID, @CEOperand1, @CEOperand2, @CEOperand3, @CEOperator,
@CEData, @CEEffect, @CEGroup, @CEType, @CEImportance, @CEOrder, @CEStatus,
getDate(), getDate(), @CEName, @CEDescription,
@CEOntologyID, @ContextID, @CEDisplayName, @CESortName, @CEXsl,
@CEOperand1Extensions, @CEOperand2Extensions, @CEOperand3Extensions)

set @ConceptExpressionID = @@IDENTITY
end
GO


SET QUOTED_IDENTIFIER OFF
GO

SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

SET ANSI_NULLS ON
GO


CREATE PROCEDURE IX_GetConceptsByConceptExpression
(
@pIX_ConceptID bigint
)
AS
select * from IX_Concepts where IX_ConceptID In(

select IX_Operand2 from IX_ConceptExpressions
where IX_ConceptID = @pIX_ConceptID and
IX_Type = 'CE' and
IX_Operator = 'AND'
union

select IX_Operand1 from IX_ConceptExpressions
where IX_ConceptID = @pIX_ConceptID and
IX_Type = 'RE' and
IX_Operator = 'AND'

union

select IX_Operand2 from IX_ConceptExpressions
where IX_ConceptID = @pIX_ConceptID and
IX_Type = 'RE' and
IX_Operator = 'AND'

)


GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO

CREATE PROCEDURE IX_GetDocumentCountByConceptIDandViewID

(
@pIX_ConceptID bigint,
@pIX_ViewID bigint
)

AS

select count(distinct IX_DocumentID) as number from IX_DocumentFolders where IX_FolderID in (
select IX_FolderID from IX_Folders where IX_ViewID = @pIX_ViewID and IX_FolderID in (
select IX_FolderID from IX_FolderConcepts where IX_ConceptID = @pIX_ConceptID
)
)

and

IX_DocumentID in (
select IX_DocumentID from IX_DocumentConcepts where IX_FolderConceptID in (
select IX_FolderConceptID from IX_FolderConcepts where IX_ConceptID = @pIX_ConceptID
)
)

GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO

CREATE PROCEDURE IX_GetConceptByConceptID

(
@pIX_ConceptID bigint
)

AS
select * from IX_Concepts where IX_ConceptID = @pIX_ConceptID
RETURN

GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO


CREATE PROCEDURE IX_GetFolderConceptsByCoceptID

(
@pIX_ConceptID bigint

)

AS
select * from IX_FolderConcepts where IX_ConceptID = @pIX_ConceptID


GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO

CREATE PROCEDURE IX_UpdateFolderConceptStatusActive
(
@PIX_FolderConceptID bigint,
@pIX_Status varchar(10),
@pIX_Active varchar(500)
)

AS
UPDATE IX_FolderConcepts
SET
IX_Status = @pIX_Status,
IX_Active = @pIX_Active,
IX_LastUpdateDate = GetDate()
WHERE IX_FolderConceptID = @PIX_FolderConceptID
RETURN


GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO


CREATE PROCEDURE IX_UpdateFolderStatus
(
@pIX_FolderID bigint,
@pIX_Status varchar(10)
)
AS
UPDATE IX_Folders SET IX_Status = @pIX_Status, IX_LastUpdateDate = GetDate()
WHERE IX_FolderID = @pIX_FolderID

GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO

CREATE PROCEDURE IX_GetConceptIdAndReplacementIDByViewId

(
@pIX_ViewID bigint

)

AS
SELECT IX_ConceptID, IX_ReplacementID FROM IX_ViewConcepts WHERE IX_ViewID = @pIX_ViewID
RETURN

GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO

CREATE PROCEDURE IX_UpdateDocumentKeywords

(
@pIX_ConceptID bigint,
@pIX_DocumentID bigint,
@pIX_NumberOfHits int,
@pIX_Importance varchar(500)
)

AS
UPDATE IX_DocumentKeywords
SET IX_Importance = IX_Importance + @pIX_Importance ,
IX_NumberOfHits = IX_NumberOfHits + @pIX_NumberOfHits,
IX_LastUpdateDate = getdate()
WHERE IX_DocumentID = @pIX_DocumentID and IX_ConceptID = @pIX_ConceptID

SELECT IX_DocumentKeywordID FROM IX_DocumentKeywords
WHERE IX_DocumentID = @pIX_DocumentID and IX_ConceptID = @pIX_ConceptID

RETURN

GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO

CREATE PROCEDURE IX_GEtConceptExpresionRowsByConceptMC
(
@pIX_conceptID bigint
)
AS
select IX_ConceptExpressionID, IX_Operand1, IX_Operand2, IX_Operator, IX_Type, IX_Data
from IX_ConceptExpressions
where IX_ConceptID = @pIX_conceptID

GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO


CREATE PROCEDURE IX_GetDocumentIDsByConceptIDandViewID

(
@pIX_ConceptID bigint,
@pIX_ViewID bigint
)

AS

select distinct IX_DocumentID as number from IX_DocumentFolders where IX_FolderID in (
select IX_FolderID from IX_Folders where IX_ViewID = @pIX_ViewID and IX_FolderID in (
select IX_FolderID from IX_FolderConcepts where IX_ConceptID = @pIX_ConceptID
)
)

and

IX_DocumentID in (
select IX_DocumentID from IX_DocumentConcepts where IX_FolderConceptID in (
select IX_FolderConceptID from IX_FolderConcepts where IX_ConceptID = @pIX_ConceptID
)
)


GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO

CREATE PROCEDURE IX_UpdateFolderConceptsValidByConceptID

(
@pIX_ConceptID bigint,
@pIX_Valid varchar(20)
)

AS
update IX_FolderConcepts
set IX_Valid = @pIX_Valid, IX_LastUpdateDate = GetDate()
where IX_ConceptID = @pIX_ConceptID


GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO

CREATE PROCEDURE IX_GetFolderIDsByDocumentIDAndViewID
(
@pIX_DocumentID bigint,
@pIX_ViewID bigint
)
AS
select IX_FolderID from IX_Folders where IX_FolderID in (
select IX_FolderID
from IX_DocumentFolders
where IX_DocumentID = @pIX_DocumentID
)

and IX_ViewID = @pIX_ViewID


GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO

CREATE PROCEDURE dbo.IX_ExistConceptExpression

(
@pIX_ConceptID bigint,
@pIX_exists smallint OUTPUT
)

AS
if exists (select * from IX_ConceptExpressions where IX_ConceptId = @pIX_ConceptID)
set @pIX_exists = 1
else set @pIX_exists = 0
RETURN

GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO



SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO

CREATE PROCEDURE dbo.IX_GetConceptExpressionsByConceptID

(
@pIX_ConceptID bigint
)
AS
select * from IX_ConceptExpressions where IX_ConceptID = @pIX_ConceptID
RETURN

GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO

CREATE PROCEDURE dbo.IX_GetConceptsByName

(
@pIX_Name varchar(500)
)
AS
select IX_Name from IX_Concepts where IX_Type = 'K' and IX_Name like @pIX_Name
RETURN

GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO

CREATE PROCEDURE dbo.IX_GetConceptNameFromStemID
(
@pIX_ConceptID bigint,
@pIX_ViewID bigint
)
AS
select IX_Name from IX_Concepts where IX_ConceptID in
(select IX_ConceptID from IX_ViewConcepts where IX_ReplacementID = @pIX_ConceptID
and IX_Type = 'KR' and IX_ViewID = @pIX_ViewID)
RETURN

GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO


SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO

CREATE PROCEDURE IX_GetAllDocumentIDsByViewID
(
@pIX_ViewID bigint
)
AS

select distinct IX_DocumentID from IX_DocumentFolders where IX_FolderID in(
select IX_FolderID
from IXFolders
where IX_ViewID = @pIX_ViewID
)

GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO



SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO

CREATE PROCEDURE IX_GetDocumentIDsByConceptNameAndViewID
(
@pIX_Name varchar(500),
@pIX_ViewID bigint
)
AS

select distinct IX_DocumentID from IX_DocumentFolders where IX_FolderID in (
select IX_FolderID from IX_Folders where IX_ViewID = @pIX_ViewID and IX_FolderID in (
select IX_FolderID from IX_FolderConcepts where IX_ConceptID in(
select IX_ConceptID from IX_Concepts where IX_Name like @pIX_Name
)
)
)

and

IX_DocumentID in (
select IX_DocumentID from IX_DocumentConcepts where IX_FolderConceptID in (
select IX_FolderConceptID from IX_FolderConcepts where IX_ConceptID in(
select IX_ConceptID from IX_Concepts where IX_Name like @pIX_Name
)
)
)
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO

CREATE PROCEDURE IX_GetNameByConceptID
(
@pIX_ConceptID bigint
)
AS
select IX_Name from IX_Concepts where IX_ConceptID = @pIX_ConceptID
RETURN

GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

CREATE PROCEDURE IX_GetConceptIDForSense
(
@pIX_Name varchar(500),
@pIX_Type varchar(500),
@pIX_ContextID bigint
)

AS

SELECT IX_ConceptID, IX_Importance FROM IX_Concepts WHERE IX_Name = @pIX_Name AND IX_Type = @pIX_Type AND IX_ContextID = @pIX_ContextID
RETURN
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO

CREATE PROCEDURE IX_GetDocumentIDsByFolderID
(
@pIX_FolderID bigint

)
AS
select IX_DocumentID from IX_DocumentFolders where IX_FolderID = @pIX_FolderID

GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO

CREATE PROCEDURE IX_GetDocumentIDsByConceptRange
(
@pIX_First varchar(500),
@pIX_Second varchar(500),
@pIX_ViewID bigint
)
AS
select distinct IX_DocumentID from IX_DocumentFolders where IX_FolderID in (
select IX_FolderID from IX_Folders where IX_ViewID = @pIX_ViewID and IX_FolderID in (
select IX_FolderID from IX_FolderConcepts where IX_ConceptID in(
select IX_ConceptID from IX_Concepts where IX_Code = 'N' and cast(IX_Name as bigint) between @pIX_First and @pIX_Second
)
)
)

and

IX_DocumentID in (
select IX_DocumentID from IX_DocumentConcepts where IX_FolderConceptID in (
select IX_FolderConceptID from IX_FolderConcepts where IX_ConceptID in(
select IX_ConceptID from IX_Concepts where IX_Code = 'N' and cast(IX_Name as bigint) between @pIX_First and @pIX_Second
)
)
)
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO

CREATE PROCEDURE IX_GetDocumentIDsByConceptId
(
@pIX_ConceptID bigint
)
AS
select distinct IX_DocumentID from IX_DocumentConcepts where IX_FolderConceptID in (
select IX_FolderConceptID from IX_FolderConcepts where IX_ConceptID = @pIX_ConceptID
)

GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

CREATE PROCEDURE IX_InsertConcurrentUse
(
@pIX_TimeSlot bigint,
@pIX_UserID bigint,
@pIX_Status varchar (10),
@pIX_Code varchar (500),
@pIX_GUID varchar (10),
@pIX_SizeKB int,
@pIX_IPAddress varchar (500),
@pIX_ConcurrentUseID bigint output

)
AS
insert into IX_ConcurrentUse ( IX_TimeSlot, IX_UserID, IX_Date,
IX_Status, IX_Code, IX_CreationDate, IX_LastUpdateDate,
IX_GUID, IX_SizeKB, IX_IPAddress)

values (@pIX_TimeSlot, @pIX_UserID, GetDate(),
@pIX_Status, @pIX_Code, GetDate(), GetDate(), @pIX_GUID,
@pIX_SizeKB, @pIX_IPAddress)

SET @pIX_ConcurrentUseID = @@IDENTITY
GO

CREATE PROCEDURE IX_GetUserNameAndSessionByDate
(
@StartDate datetime,
@EndDate datetime
)

AS
SELECT u.User_First_Name, u.User_Mid_Initial, u.User_Last_Name, c.IX_GUID, c.IX_TimeSlot, c.IX_UserId
FROM IX_ConcurrentUse c, TbUserId u
WHERE IX_Date>= @StartDate And IX_Date <= @EndDate
AND c.IX_UserId = u.User_Nbr

GO

CREATE PROCEDURE IX_GetDataIngestedByDate
(
@StartDate datetime,
@EndDate datetime
)

AS
SELECT IX_SizeKB
FROM IX_ConcurrentUse
WHERE IX_Date>= @StartDate And IX_Date <= @EndDate

GO

CREATE PROCEDURE dbo.IX_GetUserSettingsUserId

AS
Select distinct IX_UserId
from IX_UserViews uv, IX_UserSettings us
where uv.IX_UserViewId = us.IX_UserViewId
AND us.IX_Status = 'A' AND us.IX_Type = 'R'
GO

CREATE PROCEDURE dbo.IX_GetGlobalUserSettingsUserId

AS
Select distinct IX_UserId
from IX_UserViews uv, IX_UserSettings us
where uv.IX_UserViewId = us.IX_UserViewId
AND us.IX_Status = 'A' AND us.IX_Type = 'G'
GO

CREATE PROCEDURE dbo.IX_GetUserSettingsResultByUserId
@UserId bigint
AS
Select v.IX_ProjectId, us.IX_Component, us.IX_Name, us.IX_Value
from IX_UserViews uv, IX_Views v, IX_UserSettings us
where uv.IX_UserId = @UserId
And uv.IX_ViewId = v.IX_ViewId
AND uv.IX_UserViewId = us.IX_UserViewId
AND us.IX_Status = 'A' AND us.IX_Type = 'R'
GO
CREATE PROCEDURE dbo.IX_GetGlobalUserSettingsResultByUserId
@UserId bigint
AS
Select us.IX_Component, us.IX_Name, us.IX_Value
from IX_UserViews uv, IX_UserSettings us
where uv.IX_UserId = @UserId
AND uv.IX_UserViewId = us.IX_UserViewId
AND us.IX_Status = 'A' and us.IX_Type = 'G'
GO

CREATE PROCEDURE IX_GetUsersFromConcurrentUse

AS
SELECT IX_UserID
FROM IX_ConcurrentUse
GO

CREATE PROCEDURE IX_GetTotalSizeOfIngestedData

AS
SELECT SUM(IX_SizeKB) as totalSize
FROM IX_Documents
GO

CREATE PROCEDURE IX_GetTotalNumberOfUsers

AS
SELECT COUNT(User_Nbr)as totalNumber
FROM TbUserId
Where User_Nbr_Type_Id = 1
GO

CREATE PROCEDURE IX_InsertMessageThread
@MachineId [varchar] (500),
@InstanceId [varchar] (500),
@ThreadName [varchar] (500),
@ParentId [bigint],
@Status [varchar] (100),
@Type [varchar] (10),
@Activity [varchar] (500),
@BatchID [bigint],
@ID [bigint] OUTPUT
AS
INSERT INTO IX_MessageThreads (
IX_MachineId,
IX_InstanceId,
IX_ThreadName,
IX_ParentId,
IX_Status,
IX_Type,
IX_Activity,
IX_BatchID,
IX_CreationDate,
IX_LastUpdated )
VALUES (
@MachineId,
@InstanceId,
@ThreadName,
@ParentId,
@Status,
@Type,
@Activity,
@BatchID,
GetDate(),
GetDate() )
SET @ID = @@IDENTITY
GO

CREATE PROCEDURE IX_GetMessageThread
@MachineId [varchar] (500),
@InstanceId [varchar] (500),
@ThreadName [varchar] (500)
AS
SELECT *
FROM IX_MessageThreads
WHERE IX_MachineId = @MachineId
AND IX_InstanceId = @InstanceId
AND IX_ThreadName = @ThreadName
GO

CREATE PROCEDURE IX_GetTimeSlotAndSessionToCheckForDuplicates(
@pTimeSlot bigint,
@pGUID varchar (10)
)
AS
SELECT IX_ConcurrentUseID, IX_TimeSlot, IX_GUID
FROM IX_ConcurrentUse
Where IX_TimeSlot = @pTimeSlot
AND IX_GUID = @pGUID
GO

CREATE PROCEDURE dbo.IX_GetUserSettingsResult
AS
Select uv.IX_UserId, v.IX_ProjectId, us.IX_Component, us.IX_Name, us.IX_Value
from IX_UserViews uv, IX_Views v, IX_UserSettings us
where uv.IX_ViewId = v.IX_ViewId
AND uv.IX_UserViewId = us.IX_UserViewId
AND us.IX_Status = 'A' AND us.IX_Type = 'R'
order by IX_UserId
GO
CREATE PROCEDURE dbo.IX_GetGlobalUserSettingsResult
AS
Select uv.IX_UserId, us.IX_Component, us.IX_Name, us.IX_Value
from IX_UserViews uv, IX_UserSettings us
where uv.IX_UserViewId = us.IX_UserViewId
AND us.IX_Status = 'A' AND us.IX_Type = 'G'
order by IX_UserId
GO

CREATE PROCEDURE dbo.IX_GetMessageThreadID
@MachineId varchar (500),
@InstanceId varchar (500),
@ThreadName varchar (500)
AS
SELECT TOP 1 IX_ID
FROM IX_MessageThreads
WHERE IX_MachineId = @MachineId
AND IX_InstanceId = @InstanceId
AND IX_ThreadName = @ThreadName
GO

CREATE PROCEDURE IX_UpdateMessageThread
@ID [bigint],
@MachineId [varchar] (500),
@InstanceId [varchar] (500),
@ThreadName [varchar] (500),
@ParentId [bigint],
@Status [varchar] (100),
@Type [varchar] (10),
@Activity [varchar] (500),
@BatchID [bigint]
AS
UPDATE IX_MessageThreads
SET
IX_MachineId = @MachineID,
IX_InstanceId = @InstanceId,
IX_ThreadName = @ThreadName,
IX_ParentId = @ParentId,
IX_Status = @Status,
IX_Type = @Type,
IX_Activity = @Activity,
IX_BatchID = @BatchID,
IX_LastUpdated = getdate()
WHERE IX_Id = @ID
GO


CREATE PROCEDURE dbo.IX_GetMessageThreadResults
AS
SELECT *
FROM IX_MessageThreads
ORDER BY IX_MachineID, IX_InstanceID, IX_ThreadName
GO

CREATE PROCEDURE dbo.IX_DeleteMessageThread
@MachineId varchar (500),
@InstanceId varchar (500)
AS
DELETE FROM IX_MessageThreads
WHERE IX_MachineId = @MachineId
AND IX_InstanceId = @InstanceId
GO
CREATE PROCEDURE IX_GetWordOrderInDocument
(
@pIX_DocumentID bigint,
@pIX_ConceptID bigint
)
AS

select IX_WordOrder from IX_DocumentWordOrders where IX_DocumentKeywordID in (
select IX_DocumentKeywordID
from IX_DocumentKeywords
where IX_DocumentID = @pIX_DocumentID and
IX_ConceptID = @pIX_ConceptID
)
GO
CREATE PROCEDURE IX_GetSenseStrength
(
@pIX_ViewID bigint,
@pIX_ConceptID bigint,
@pIX_Type varchar(500)
)
AS
SELECT IX_SenseStrength
FROM IX_ViewConcepts
WHERE IX_ViewID = @pIX_ViewID and IX_ConceptID = @pIX_ConceptID and IX_Type = @pIX_Type

GO

CREATE PROCEDURE IX_GetViewConceptId
(
@pIX_ViewID bigint,
@pIX_ConceptID bigint,
@pIX_Type varchar(500)
)
AS
SELECT IX_ViewConceptID
FROM IX_ViewConcepts
WHERE IX_ViewID = @pIX_ViewID and IX_ConceptID = @pIX_ConceptID and IX_Type = @pIX_Type
GO

CREATE PROCEDURE IX_UpdateSenseStrength
(
@pIX_ViewID bigint,
@pIX_ConceptID bigint,
@pIX_Type varchar(500)
)
AS
UPDATE IX_ViewConcepts
SET
IX_SenseStrength = IX_SenseStrength +1 ,
IX_LastUpdateDate = getdate()

WHERE IX_ViewID = @pIX_ViewID and IX_ConceptID = @pIX_ConceptID and IX_Type = @pIX_Type
GO

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
CREATE PROCEDURE IX_OntologyInsert
(
@ViewID bigint,
@CType varchar(10),
@CName nvarchar(400),
@CDescription varchar(500),
@CEType varchar(10),
@CEName nvarchar(400),
@CEData varchar(500),
@CERawOntology text,
@CEOntologyTree text,
@ConceptID bigint output,
@ConceptExpressionRawID bigint output,
@ConceptExpressionTreeID bigint output,
@ViewConceptID bigint output
)
AS
begin
insert into IX_Concepts (
IX_Name, IX_Type, IX_Importance,
IX_Description, IX_Status, IX_CreationDate, IX_LastUpdateDate,
IX_CreatedByCode, IX_Code, IX_ContextID )

values (@CName, @CType, 0,
@CDescription, '', GetDate(), GetDate(),
'', '', 0)

set @ConceptID = @@IDENTITY

insert into IX_ConceptExpressions (
IX_ConceptID, IX_Operand1, IX_Operand2, IX_Operand3, IX_Operator,
IX_Data, IX_Effect, IX_Group, IX_Type, IX_Importance, IX_Order, IX_Status,
IX_CreationDate, IX_LastUpdateDate, IX_Name, IX_Description,
IX_OntologyID, IX_ContextID, IX_DisplayName, IX_SortName, IX_Control,
IX_Operand1Extensions, IX_Operand2Extensions, IX_Operand3Extensions )

values (@ConceptID, 0, 0, 0, '',
@CEData, '', '', @CType, 0, 0, '',
GetDate(), GetDate(), @CEName, '',
0, 0, '', '', @CERawOntology,
'', '', '')

set @ConceptExpressionRawID = @@IDENTITY

insert into IX_ConceptExpressions (
IX_ConceptID, IX_Operand1, IX_Operand2, IX_Operand3, IX_Operator,
IX_Data, IX_Effect, IX_Group, IX_Type, IX_Importance, IX_Order, IX_Status,
IX_CreationDate, IX_LastUpdateDate, IX_Name, IX_Description,
IX_OntologyID, IX_ContextID, IX_DisplayName, IX_SortName, IX_Control,
IX_Operand1Extensions, IX_Operand2Extensions, IX_Operand3Extensions )

values (@ConceptID, 0, 0, 0, '',
@CEData, '', '', @CEType, 0, 0, '',
GetDate(), GetDate(), @CEName, '',
0, 0, '', '', @CEOntologyTree,
'', '', '')

set @ConceptExpressionTreeID = @@IDENTITY

insert into IX_ViewConcepts (
IX_ViewID, IX_ConceptID, IX_Type, IX_Status,
IX_CreationDate,IX_LastUpdateDate, IX_ReplacementID,
IX_Importance, IX_SenseID, IX_SenseStrength )

values (@ViewID, @ConceptID, @CType, '',
GetDate(), GetDate(), 0,
0, 0, 0)

set @ViewConceptID = @@IDENTITY
end
GO


CREATE PROCEDURE IX_OntologyDelete
(
@IdList varchar (3500),
@TypeRO varchar (10),
@TypeOT varchar (10)
)
AS
DECLARE @sql1 nvarchar(3600)
DECLARE @sql2 nvarchar(3600)
DECLARE @sql3 nvarchar(3600)

SET @sql1 = 'DELETE FROM IX_Concepts WHERE (IX_ConceptID IN ( ' + @IdList + ')) AND (IX_Type = ''' + @TypeRO + ''')'
SET @sql2 = 'DELETE FROM IX_ConceptExpressions WHERE (IX_ConceptID IN (' + @IdList + ')) AND ((IX_Type = ''' + @TypeRO + ''') OR (IX_Type = ''' + @TypeOT + '''))'
SET @sql3 = 'DELETE FROM IX_ViewConcepts WHERE (IX_ConceptID IN (' + @IdList + ')) AND (IX_Type = ''' + @TypeRO + ''')'

EXEC sp_executesql @sql1, N'@IdList varchar (3500)', @IdList = @IdList
EXEC sp_executesql @sql2, N'@IdList varchar (3500)', @IdList = @IdList
EXEC sp_executesql @sql3, N'@IdList varchar (3500)', @IdList = @IdList
GO


CREATE PROCEDURE IX_OntologyGetList
(
@ViewID bigint,
@Type varchar(10)
)
AS
SELECT C.IX_ConceptId, C.IX_Name, C.IX_CreationDate, C.IX_Description
FROM IX_Concepts C, IX_ConceptExpressions CE, IX_ViewConcepts VC
WHERE C.IX_ConceptId = CE.IX_ConceptId AND C.IX_ConceptId = VC.IX_ConceptId
AND C.IX_Type = @Type AND CE.IX_Type = @Type
AND VC.IX_Type = @Type AND VC.IX_ViewID = @ViewID
GO


CREATE PROCEDURE IX_OntologyGetTree
(
@ContextID bigint,
@Type varchar(10)
)
AS
SELECT IX_Control
FROM IX_ConceptExpressions
WHERE IX_ConceptId = @ContextID AND IX_Type = @Type
GO


CREATE PROCEDURE IX_OntologySetTree
(
@ContextID bigint,
@Type varchar(10),
@CEOntologyTree text
)
AS
UPDATE IX_ConceptExpressions SET IX_Control = @CEOntologyTree
WHERE IX_ConceptId = @ContextID AND IX_Type = @Type
GO

create procedure IX_DRByKeyWord_Lvl0( @report_id int, @proximity int, @br1 char(1), @br2 char(1), @br3 char(1), @selectListInd char(1))
as
begin

-- selectList = 'N' indicates that relationships to be inserted into #t0sum table
-- a 'Y' indiactes that listnum of 1 to be replaced by new list with composite concepts.
declare @KID varchar(56)


if (@selectListInd = 'N') --create a staging table to store hits for composite concepts (relations)
begin
create table #stage (DocNM varchar(512), ComboKID char(56), offset1 int, offset2 int)
end
else
begin
create table #t0sum(KIDlvl0 varchar(56), count int)
end

declare cc0 cursor for
select KID
from IX_DRKIDList
where report_id = @report_id
and ListNum = 1
for read only

open cc0
FETCH NEXT FROM cc0
INTO @KID

WHILE @@FETCH_STATUS = 0
BEGIN

if (upper(@br1) = 'Y')
begin
if (@selectListInd = 'Y')
begin
insert into #t0sum
select (rtrim(ltrim(a.KID)) + ',' + rtrim(ltrim(b.kid)) + ',R1') as comboKID, count(distinct a.docNM) as r1
from IX_DRDocHits a, IX_DRDocHits b
where a.KID = @KID
and a.docNM = b.docNM
and a.report_id = b.report_id
and a.report_id = @report_id
and b.KID <> @KID
and b.KID in (select KID from IX_DRKIDList where report_ID = @report_id and ListNum = 2)
group by a.KID, b.KID
end
else
begin
insert into #stage
select a.DocNM, (rtrim(ltrim(a.KID)) + ',' + rtrim(ltrim(b.kid)) + ',R1') as comboKID, a.offset, b.offset
from IX_DRDocHits a, IX_DRDocHits b
where a.KID = @KID
and a.docNM = b.docNM
and a.report_id = b.report_id
and a.report_id = @report_id
and b.KID <> @KID
and b.KID in (select KID from IX_DRKIDList where report_ID = @report_id and ListNum = 2)
end
end
if (upper(@br2) = 'Y' and ((upper(@br1) = 'Y' and @@rowcount > 0) or (upper(@br1) = 'N')))
begin
if (@selectListInd = 'Y')
begin
insert into #t0sum
select (rtrim(ltrim(a.KID)) + ',' + rtrim(ltrim(b.kid)) + ',R2') as comboKID, count(distinct a.docNM) as r2
from IX_DRDocHits a, IX_DRDocHits b
where a.KID = @KID
and a.docNM = b.docNM
and a.report_id = b.report_id
and a.report_id = @report_id
and b.KID <> @KID
and abs(a.offset - b.offset) <= @proximity
and b.KID in (select KID from IX_DRKIDList where report_ID = @report_id and ListNum = 2)
group by a.KID, b.KID
end
else
begin
insert into #stage
select a.DocNM, (rtrim(ltrim(a.KID)) + ',' + rtrim(ltrim(b.kid)) + ',R1') as comboKID, a.offset, b.offset
from IX_DRDocHits a, IX_DRDocHits b
where a.KID = @KID
and a.docNM = b.docNM
and a.report_id = b.report_id
and a.report_id = @report_id
and b.KID <> @KID
and abs(a.offset - b.offset) <= @proximity
and b.KID in (select KID from IX_DRKIDList where report_ID = @report_id and ListNum = 2)
end
end

if (upper(@br3) = 'Y')
if ((upper(@br2) = 'Y' and @@rowcount > 0) or ((upper(@br2) = 'N' ) and ((upper(@br1) = 'Y' and @@rowcount > 0) or (upper(@br1) = 'N'))))
begin
if (@selectListInd = 'Y')
begin
insert into #t0sum
select (rtrim(ltrim(a.KID)) + ',' + rtrim(ltrim(b.kid)) + ', R3') as comboKID, count(distinct a.docNM) as r3
from IX_DRDocHits a, IX_DRDocHits b
where a.KID = @KID
and a.docNM = b.docNM
and a.report_id = b.report_id
and a.report_id = @report_id
and b.KID <> @KID
and abs(a.offset - b.offset) <= 1
and b.KID in (select KID from IX_DRKIDList where report_ID = @report_id and ListNum = 2)
group by a.KID, b.KID
end
else
begin
insert into #stage
select a.DocNM, (rtrim(ltrim(a.KID)) + ',' + rtrim(ltrim(b.kid)) + ',R1') as comboKID, a.offset, b.offset
from IX_DRDocHits a, IX_DRDocHits b
where a.KID = @KID
and a.docNM = b.docNM
and a.report_id = b.report_id
and a.report_id = @report_id
and b.KID <> @KID
and abs(a.offset - b.offset) <= 1
and b.KID in (select KID from IX_DRKIDList where report_ID = @report_id and ListNum = 2)
end

end
-- delete the doc hits for the @KID and also delete entry in IX_DRKIDList
-- insert combo concept in to IX_DRKIDList
begin transaction
delete from IX_DrDocHits where KID = @KID and report_id = @report_id
delete from IX_DRKIDList where ListNum = 1 and report_id = @report_id and KID = @KID
commit transaction
fetch next from cc0
into @KID
END
close cc0
deallocate cc0
if (upper(@selectListInd) = 'Y')
select * from #t0sum
else
-- populate the DRKIDList with listnum = 1
-- populate DRDocHits table from #stage
begin
insert into IX_DRDocHits
select distinct @report_id, DocNM, ComboKID, offset
from ( select DocNM, ComboKID, offset1 as offset
from #stage
union all
select DocNM, ComboKID, offset2 as offset
from #stage
) a

insert into IX_DRKidList
select distinct @report_id, 1, ComboKID
from #stage

drop table #stage

end

END
GO

create procedure IX_DRByKeyWord_Lvl1( @report_id int, @proximity int, @br1 char(1), @br2 char(1), @br3 char(1), @selectListInd char(1))
as begin

--create table #t0sum(KIDlvl1 varchar(56), count int)

exec IX_DRByKeyWord_Lvl0 @report_id, @proximity , @br1 , @br2 , @br3, 'N'
exec IX_DRByKeyWord_Lvl0 @report_id, @proximity , @br1 , @br2 , @br3, 'Y'
END
GO

create procedure IX_DRByKeyWord_Lvl2( @report_id int, @proximity int, @br1 char(1), @br2 char(1), @br3 char(1), @selectListInd char(1))
as begin

--create table #t0sum(KIDlvl1 varchar(56), count int)

exec IX_DRByKeyWord_Lvl0 @proximity , @br1 , @br2 , @br3, 'N'
exec IX_DRByKeyWord_Lvl0 @proximity , @br1 , @br2 , @br3, 'N'
exec IX_DRByKeyWord_Lvl0 @proximity , @br1 , @br2 , @br3, 'Y'

END
GO


create procedure IX_DRByKeyWord_Lvl3( @report_id int, @proximity int, @br1 char(1), @br2 char(1), @br3 char(1), @selectListInd char(1))
as begin

--create table #t0sum(KIDlvl1 varchar(56), count int)

exec IX_DRByKeyWord_Lvl0 @proximity , @br1 , @br2 , @br3, 'N'
exec IX_DRByKeyWord_Lvl0 @proximity , @br1 , @br2 , @br3, 'N'
exec IX_DRByKeyWord_Lvl0 @proximity , @br1 , @br2 , @br3, 'N'
exec IX_DRByKeyWord_Lvl0 @proximity , @br1 , @br2 , @br3, 'Y'

END
GO


create procedure IX_DeleteDRDocHitsByReportId(@reportId int)
as begin

delete from IX_DRDocHits
where report_id = @reportID

end
GO


create procedure IX_DeleteDRKidListByReportId(@reportId int)
as begin

delete from IX_DRKIDList
where report_id = @reportID

END
GO


CREATE PROCEDURE dbo.IX_GetChildConceptsByKeyWordID
@keyWordId int,
@userNbr int

AS
select distinct e.keyword_txt as childKeyword, f.ConceptType_Description as parentType, d.keyword_id as parentKeyID
from tbuserid a, tbkeyxkey b, tbkeyword d, tbkeyword e, tbConceptType f
Where a.user_nbr = @userNbr
and b.userobject_id = (select userobject_id from tbuserobject where user_nbr = a.profile_nbr)
and d.keyword_id = @keyWordID
and b.status='A'
and d.keyword_id = b.parent_keyword_id
and b.child_keyword_id = e.keyword_id
and d.ConceptType_ID = f.ConceptType_ID

GO


create procedure IX_LoadDRDocHits(@xmldoc varchar(8000), @report_id int)
as begin
set NOCOUNT ON
declare @idoc int



--set @xmldoc ='
--<DocHits>
--<KeyWord KeyWordID="4">
-- <Doc DocNM="C:\M10248" >
-- <DocHit Offset="11000" />
-- <DocHit Offset="428888" />
-- </Doc>
--</KeyWord>
--<KeyWord KeyWordID="12">
-- <Doc DocNM="C:\M10249" >
-- <DocHit Offset="03" />
-- <DocHit Offset="408" />
-- </Doc>
--</KeyWord>
--</DocHits>'
--Create an internal representation of the XML document.
exec sp_xml_preparedocument @idoc OUTPUT, @xmldoc
-- Delete stmt using OPENXML rowset provider
/*delete IX_DRDocHits from IX_DRDocHits a,
(select *
FROM OPENXML (@idoc, '/DocHits/KeyWord/Doc/DocHit',2)
WITH ( DocNM varchar(512) '../@DocNM',
KeyWordID int '../../@KeyWordID',
Offset int '@Offset')) b
where a.DocNM = b.DocNM
and a.KeyWordID = b.KeyWordID
*/

insert into IX_DRDocHits (report_id, DocNM, KID, Offset)
select @report_id, *
FROM OPENXML (@idoc, '/DocHits/KeyWord/Doc/DocHit',2)
WITH (DocNM varchar(512) '../@DocNM',
KeyWordID varchar(56) '../../@KeyWordID',
Offset int '@Offset')

EXEC sp_xml_removedocument @idoc
end
GO


CREATE PROCEDURE dbo.IX_LoadDRKeyWordIDList
@xmldoc varchar(8000),
@listNum int,
@report_id int
as begin
set NOCOUNT ON

declare @idoc int


--set @xmldoc ='
--<KeyWordIDList>
--<KeyWord KID="4"/>
--<KeyWord KID="12"/>
--</KeyWordIDList>'
--create an internal representation of the XML document.
exec sp_xml_preparedocument @idoc OUTPUT, @xmldoc


if (@listNum = 1)
begin
--create table IX_DRKIDList (KID int)
insert into IX_DRKIDList
select @report_id, 1, *
FROM OPENXML (@idoc ,'/KeyWordIDList/KeyWord',2)
WITH (KID int '@KID' )
--select * from IX_DRKIDList
end
else
begin
--create table IX_DRKIDList (KID int)
insert into IX_DRKIDList
select @report_id, 2,*
FROM OPENXML (@idoc ,'/KeyWordIDList/KeyWord',2)
WITH (KID varchar(24) '@KID' )
--select * from IX_DRKIDList
end



EXEC sp_xml_removedocument @idoc

end
GO


create procedure IX_UpdateReqReportStatus(@reportId int, @newStatus char(1), @oldStatus Char(1))
as begin

Update TbReqReports set complete_flag = @newStatus
, mode_date_time = getdate()
where complete_flag = @oldStatus
and report_name in (select report_name from tbreqreports where report_id = @reportID)
end
GO


create procedure IX_getDRFileList( @reportId int)
as begin


declare @er int
declare @userNbr int
select @er = patindex('%VIEW%', upper(executereport)),
@userNbr = user_nbr
from TbReqReports
where report_id = @reportId

if (@@rowcount = 0)
begin
RAISERROR ('Can not find the report for report_id %d' , 16, 1, @reportId)
end
if (@er > 0)
begin
SELECT distinct B.object_hyperlink, B.object_id, B.object_type
FROM TbUserobject A, tbobject B
WHERE A.user_nbr= @userNbr
AND A.object_type <> 'F'
AND A.object_id = B.object_id
end
else
begin
SELECT distinct B.object_hyperlink, B.object_id, B.object_type
FROM TbUserobject A, tbobject B, tbreportfolder c
WHERE A.user_nbr= @userNbr
AND A.object_type <> 'F'
and a.parent_id = c.userobject_id
and c.report_id = @reportId
AND A.object_id = B.object_id
end

end
GO


------------------------------------END IxSprocs.sql-------------------------------------


------------------------------------BEGIN IxAlterData.sql----------------------------------- --


if not exists (select * from TbUIElement where UIElement_Id = 58)
insert into TbUIElement values(58, 'Administer Key', null)

if not exists (select * from TbUIElement where UIElement_Id = 59)
insert into TbUIElement values(59, 'License Key Info', 'licenceKeyInfo.aspx')

if not exists (select * from TbUIElement where UIElement_Id = 60)
insert into TbUIElement values(60, 'License Key Upload', 'KeyUpload.aspx')

if not exists (select * from TbUIElement where UIElement_Id = 61)
insert into TbUIElement values(61, 'Administer Billing', null)

if not exists (select * from TbUIElement where UIElement_Id = 62)
insert into TbUIElement values(62, 'Usage Report', 'UsageReportRun.aspx')

UPDATE TbUIElement SET UIElement_Description = 'License Key Info'
WHERE UIElement_Description = 'Licence Key Info'

UPDATE TbUIElement SET UIElement_Description = 'License Key Upload'
WHERE UIElement_Description = 'Licence Key Upload'


if not exists (select * from menu_structure where menu_id = 58)
insert into menu_structure values(58, 7, 2, 'Lic Key')

if not exists (select * from menu_structure where menu_id = 59)
insert into menu_structure values(59, 58, 3, 'License Key Info')

if not exists (select * from menu_structure where menu_id = 60)
insert into menu_structure values(60, 58, 3, 'License Key Upload')

if not exists (select * from menu_structure where menu_id = 61)
insert into menu_structure values(61, 7, 2, 'Billing System')

if not exists (select * from menu_structure where menu_id = 62)
insert into menu_structure values(62, 61, 3, 'Usage Report')

UPDATE menu_structure SET ui_element = 'License Key Info'
WHERE ui_element = 'Licence Key Info'

UPDATE menu_structure SET ui_element = 'License Key Upload'
WHERE ui_element = 'Licence Key Upload'


if not exists (select * from tbkeyexcl where keyword_name = 'take')
insert into tbkeyexcl values('take',null ,null )

if not exists (select * from tbkeyexcl where keyword_name = 'see')
insert into tbkeyexcl values('see',null ,null )


if not exists (select * from tbconstant where description = 'VerifyMacAddress')
insert into tbconstant (description,value) values('VerifyMacAddress', 0)

if not exists (select * from tbconstant where description = 'MaxSearchResultsToView')
insert into tbconstant (description,value) values('MaxSearchResultsToView', 50)


------------------------------------END IxAlterData.sql----------------------------------- --

ALTER DATABASE "IntelliDB" SET MULTI_USER
go
Top of pagePrevious messageNext messageBottom of pageLink to this message

Prasanth
Bewarse ke Bewarse!
Username: Prasanth

Post Number: 6854
Registered: 03-2004
Posted From: 203.199.213.66
Posted on Thursday, December 09, 2004 - 2:36 am:Edit PostDelete PostView Post/Check IP

>>vunna mental gallatone sattunte ee kotta vinta gaallu entra baboo
andari fans aa leka only chiru fansaa??
Top of pagePrevious messageNext messageBottom of pageLink to this message

Godfather
Bewarse ke Bewarse!
Username: Godfather

Post Number: 14615
Registered: 03-2004
Posted From: 80.63.180.90
Posted on Thursday, December 09, 2004 - 2:03 am:Edit PostDelete PostView Post/Check IP

nuvu papa va..
Top of pagePrevious messageNext messageBottom of pageLink to this message

Sudigaaali
Bewarse
Username: Sudigaaali

Post Number: 1116
Registered: 09-2004
Posted From: 202.63.117.242
Posted on Thursday, December 09, 2004 - 2:00 am:Edit PostDelete PostView Post/Check IP

Top of pagePrevious messageNext messageBottom of pageLink to this message

Balayya123
Pilla Bewarse
Username: Balayya123

Post Number: 145
Registered: 06-2004
Posted From: 129.138.6.13
Posted on Thursday, December 09, 2004 - 1:47 am:Edit PostDelete PostView Post/Check IP

vunna mental gallatone sattunte ee kotta vinta gaallu entra baboo
Top of pagePrevious messageNext messageBottom of pageLink to this message

Prasanth
Bewarse ke Bewarse!
Username: Prasanth

Post Number: 6852
Registered: 03-2004
Posted From: 203.199.213.66
Posted on Thursday, December 09, 2004 - 1:17 am:Edit PostDelete PostView Post/Check IP

intakeee nee old ID enti??


kottodivaa
Top of pagePrevious messageNext messageBottom of pageLink to this message

Ll_123456_ll
Pilla Bewarse
Username: Ll_123456_ll

Post Number: 1
Registered: 12-2004
Posted From: 210.214.109.227
Posted on Thursday, December 09, 2004 - 1:10 am:Edit PostDelete PostView Post/Check IP

went to the shooting of the last song of shankardada mbbs located in annapoorna studios last night and i caught the glimpse of megastar among the group of extras who were present..even sonali was also there...megastar looked like a moon among the stars...with recommandation..i went before megastar and my uncle who happened to be chiru's classmate introduced me to him...i took out a sheet of paper which i brought with me and gave to chiru..he took a pen and autographed it...chiru..the word was etched across my body...not across the sheet...fans babu!....then the dance dir called for shot...'ok then ' he said and was going to the set ....i thought this was now or never...i went rushing past the crowd ....i took his hand and shook it...it was warm...i could feel the gush of blood beneath it....it was very warm...ouch!..soo hot ....so hot..i couldnot resist...i shouted "mummy!"....
and then i woke up..my mother was putting the hot coffee glass on my palm and was yelling that it was getting late for college!
anthaa oka kala...it was a dream!

friends...dream ani meeku telisaaka meeku entha kopam gaa undi...edantha vinna meeka ____ kaaluthunte....mari intha manchi kala kanna naaku entha kaaluthoondo aalochinchandi

-------------------------------------------------- ------------------------------
indian film industry on one side
chiru okkade on the other side