sql.txt
上传用户:tree100901
上传日期:2007-06-03
资源大小:2295k
文件大小:28k
- CREATE TABLE [dbo].[Document] (
- [DocumentID] [int] IDENTITY (1, 1) NOT NULL ,
- [AccepterID] [nvarchar] (500) COLLATE Chinese_PRC_CI_AS NULL ,
- [Date] [datetime] NULL ,
- [State] [char] (10) COLLATE Chinese_PRC_CI_AS NULL ,
- [Title] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
- [PersonID] [int] NULL ,
- [Result] [nvarchar] (4000) COLLATE Chinese_PRC_CI_AS NULL ,
- [Content] [nvarchar] (4000) COLLATE Chinese_PRC_CI_AS NULL ,
- [Process] [nvarchar] (500) COLLATE Chinese_PRC_CI_AS NULL ,
- [WriterID] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
- [CheckedMarker] [nvarchar] (120) COLLATE Chinese_PRC_CI_AS NULL ,
- [Contents] [image] NULL
- ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
- ;
- CREATE TABLE [dbo].[Files] (
- [FileID] [int] IDENTITY (1, 1) NOT NULL ,
- [Title] [nvarchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,
- [Writer] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
- [State] [nvarchar] (500) COLLATE Chinese_PRC_CI_AS NULL ,
- [PersonID] [int] NULL ,
- [Date] [datetime] NULL ,
- [SystemID] [int] NULL ,
- [OrganizationID] [int] NULL ,
- [Contents] [image] NULL ,
- [ContentType] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
- [ByteSize] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
- [FileKind] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
- [AccepterID] [nvarchar] (120) COLLATE Chinese_PRC_CI_AS NULL
- ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
- ;
- CREATE TABLE [dbo].[InfoCategories] (
- [InfoCategoryID] [int] IDENTITY (1, 1) NOT NULL ,
- [InfoCategoryName] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
- [OrganizationID] [int] NULL
- ) ON [PRIMARY]
- ;
- CREATE TABLE [dbo].[Infomation] (
- [InfoID] [int] IDENTITY (1, 1) NOT NULL ,
- [Writer] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
- [Title] [nvarchar] (80) COLLATE Chinese_PRC_CI_AS NULL ,
- [PersonID] [int] NOT NULL ,
- [Date] [datetime] NULL ,
- [State] [int] NULL ,
- [InfoCategoryID] [int] NULL ,
- [Contents] [image] NULL
- ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
- ;
- CREATE TABLE [dbo].[Job] (
- [JobID] [int] IDENTITY (1, 1) NOT NULL ,
- [JobName] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
- [Description] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL
- ) ON [PRIMARY]
- ;
- CREATE TABLE [dbo].[Meeting] (
- [MeetingID] [int] IDENTITY (1, 1) NOT NULL ,
- [Title] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
- [Caller] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
- [Attends] [nvarchar] (500) COLLATE Chinese_PRC_CI_AS NULL ,
- [Date] [datetime] NULL ,
- [Address] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
- [State] [nvarchar] (500) COLLATE Chinese_PRC_CI_AS NULL ,
- [AccepterID] [nvarchar] (500) COLLATE Chinese_PRC_CI_AS NULL ,
- [MeetingDate] [datetime] NULL ,
- [PersonID] [int] NULL ,
- [Result] [nvarchar] (10) COLLATE Chinese_PRC_CI_AS NULL ,
- [ReadTime] [datetime] NULL
- ) ON [PRIMARY]
- ;
- CREATE TABLE [dbo].[Message] (
- [MessageID] [int] IDENTITY (1, 1) NOT NULL ,
- [Contents] [nvarchar] (2000) COLLATE Chinese_PRC_CI_AS NULL ,
- [Date] [datetime] NULL ,
- [AccepterID] [nvarchar] (500) COLLATE Chinese_PRC_CI_AS NOT NULL ,
- [state] [int] NULL ,
- [PersonID] [int] NOT NULL ,
- [ReadTime] [datetime] NULL ,
- [Attachment] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL
- ) ON [PRIMARY]
- ;
- CREATE TABLE [dbo].[Notification] (
- [NotificationID] [int] IDENTITY (1, 1) NOT NULL ,
- [State] [char] (10) COLLATE Chinese_PRC_CI_AS NULL ,
- [Contents] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
- [PersonID] [int] NULL ,
- [Date] [datetime] NULL
- ) ON [PRIMARY]
- ;
- CREATE TABLE [dbo].[Online] (
- [ID] [int] IDENTITY (1, 1) NOT NULL ,
- [UserName] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
- [UserSN] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
- [Date] [datetime] NULL
- ) ON [PRIMARY]
- ;
- CREATE TABLE [dbo].[Organization] (
- [OrganizationID] [int] IDENTITY (1, 1) NOT NULL ,
- [OrganizationName] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
- [Description] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
- [SystemID] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
- [TypeID] [int] NULL
- ) ON [PRIMARY]
- ;
- CREATE TABLE [dbo].[Persons] (
- [PersonID] [int] IDENTITY (1, 1) NOT NULL ,
- [Name] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
- [OrganizationID] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
- [Description] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
- [JobID] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
- [Friends] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
- [Address] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
- [Phoneo] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
- [Mobile] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
- [Password] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
- [State] [nvarchar] (10) COLLATE Chinese_PRC_CI_AS NULL ,
- [Phonef] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL
- ) ON [PRIMARY]
- ;
- CREATE TABLE [dbo].[Private] (
- [PrivateID] [int] NOT NULL ,
- [Contents] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
- [PersonID] [int] NULL ,
- [Date] [datetime] NULL
- ) ON [PRIMARY]
- ;
- CREATE TABLE [dbo].[Schedule] (
- [ScheduleID] [int] IDENTITY (1, 1) NOT NULL ,
- [PlanTime] [datetime] NULL ,
- [Itime] [datetime] NULL ,
- [Contents] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
- [Result] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
- [State] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
- [PersonID] [int] NULL ,
- [Date] [datetime] NULL
- ) ON [PRIMARY]
- ;
- CREATE TABLE [dbo].[System] (
- [SystemID] [int] IDENTITY (1, 1) NOT NULL ,
- [SystemName] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
- [Description] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL
- ) ON [PRIMARY]
- ;
- ALTER TABLE [dbo].[Document] WITH NOCHECK ADD
- CONSTRAINT [PK_Document] PRIMARY KEY CLUSTERED
- (
- [DocumentID]
- ) ON [PRIMARY]
- ;
- ALTER TABLE [dbo].[Files] WITH NOCHECK ADD
- CONSTRAINT [PK_File] PRIMARY KEY CLUSTERED
- (
- [FileID]
- ) ON [PRIMARY]
- ;
- ALTER TABLE [dbo].[Infomation] WITH NOCHECK ADD
- CONSTRAINT [PK_Infomation] PRIMARY KEY CLUSTERED
- (
- [InfoID]
- ) ON [PRIMARY]
- ;
- ALTER TABLE [dbo].[Job] WITH NOCHECK ADD
- CONSTRAINT [PK_Categories] PRIMARY KEY CLUSTERED
- (
- [JobID]
- ) ON [PRIMARY]
- ;
- ALTER TABLE [dbo].[Meeting] WITH NOCHECK ADD
- CONSTRAINT [PK_Meeting] PRIMARY KEY CLUSTERED
- (
- [MeetingID]
- ) ON [PRIMARY]
- ;
- ALTER TABLE [dbo].[Message] WITH NOCHECK ADD
- CONSTRAINT [PK_Message] PRIMARY KEY CLUSTERED
- (
- [MessageID]
- ) ON [PRIMARY]
- ;
- ALTER TABLE [dbo].[Notification] WITH NOCHECK ADD
- CONSTRAINT [PK_Notification] PRIMARY KEY CLUSTERED
- (
- [NotificationID]
- ) ON [PRIMARY]
- ;
- ALTER TABLE [dbo].[Online] WITH NOCHECK ADD
- CONSTRAINT [PK_Online] PRIMARY KEY CLUSTERED
- (
- [ID]
- ) ON [PRIMARY]
- ;
- ALTER TABLE [dbo].[Organization] WITH NOCHECK ADD
- CONSTRAINT [PK_Organization] PRIMARY KEY CLUSTERED
- (
- [OrganizationID]
- ) ON [PRIMARY]
- ;
- ALTER TABLE [dbo].[Persons] WITH NOCHECK ADD
- CONSTRAINT [PK_Persons] PRIMARY KEY CLUSTERED
- (
- [PersonID]
- ) ON [PRIMARY]
- ;
- ALTER TABLE [dbo].[Private] WITH NOCHECK ADD
- CONSTRAINT [PK_Private] PRIMARY KEY CLUSTERED
- (
- [PrivateID]
- ) ON [PRIMARY]
- ;
- ALTER TABLE [dbo].[Schedule] WITH NOCHECK ADD
- CONSTRAINT [PK_Schedule] PRIMARY KEY CLUSTERED
- (
- [ScheduleID]
- ) ON [PRIMARY]
- ;
- ALTER TABLE [dbo].[System] WITH NOCHECK ADD
- CONSTRAINT [PK_System] PRIMARY KEY CLUSTERED
- (
- [SystemID]
- ) ON [PRIMARY]
- ;
- ALTER TABLE [dbo].[Document] ADD
- CONSTRAINT [FK_Document_Persons] FOREIGN KEY
- (
- [PersonID]
- ) REFERENCES [dbo].[Persons] (
- [PersonID]
- ) ON DELETE CASCADE
- ;
- ALTER TABLE [dbo].[Files] ADD
- CONSTRAINT [FK_Files_Persons] FOREIGN KEY
- (
- [PersonID]
- ) REFERENCES [dbo].[Persons] (
- [PersonID]
- ) ON UPDATE CASCADE
- ;
- ALTER TABLE [dbo].[Meeting] ADD
- CONSTRAINT [FK_Meeting_Persons] FOREIGN KEY
- (
- [PersonID]
- ) REFERENCES [dbo].[Persons] (
- [PersonID]
- ) ON UPDATE CASCADE
- ;
- ALTER TABLE [dbo].[Message] ADD
- CONSTRAINT [FK_Message_Persons] FOREIGN KEY
- (
- [PersonID]
- ) REFERENCES [dbo].[Persons] (
- [PersonID]
- ) ON DELETE CASCADE
- ;
- ALTER TABLE [dbo].[Private] ADD
- CONSTRAINT [FK_Private_Persons] FOREIGN KEY
- (
- [PersonID]
- ) REFERENCES [dbo].[Persons] (
- [PersonID]
- ) ON DELETE CASCADE ;
- |
- CREATE Procedure [dbo].[CheckOnlineUser](@UserName NVARCHAR(50) , @UserOnline CHAR(10) OUTPUT) AS
- SET @UserOnline = 'false'
- IF EXISTS(SELECT UserName FROM ONLINE WHERE UserName =@UserName)
- SET @UserOnline = 'true'
- |
- CREATE Procedure [dbo].[CheckOnlineUser1](@UserName NVARCHAR(50) , @UserOnline CHAR(10) OUTPUT) AS
- SET @UserOnline = 'false'
- IF EXISTS(SELECT UserName FROM ONLINE WHERE UserName =@UserName)
- SET @UserOnline = 'true'
- |
- CREATE Procedure [dbo].[CheckOnlineUser2](@UserName NVARCHAR(50)) AS
- DECLARE @UserOnline CHAR(10)
- SET @UserOnline = 'false'
- IF EXISTS(SELECT UserName FROM ONLINE WHERE UserName =@UserName)
- SET @UserOnline = 'true'
- select @UserOnline
- |
- CREATE Procedure [dbo].[CheckSetUser](@Name nvarchar(50),@Password nvarchar(50),@SetUser Char(10) OUTPUT,@State Char(10) OUTPUT,@PersonID int OUTPUT) AS
- Set @SetUser = 'false'
- IF EXISTS(SELECT * FROM Persons WHERE Name=@Name AND Password=@Password)
- Set @SetUser = 'true'
- SELECT @State =State, @PersonID =PersonID FROM Persons WHERE Name=@Name AND Password=@Password
- |
- CREATE PROCEDURE [dbo].[DeleteDocument] (@DocumentID int) AS
- DELETE FROM Document WHERE DocumentID = @DocumentID
- return
- |
- CREATE PROCEDURE [dbo].[DeleteFile] (@FileID int) AS
- DELETE FROM Files WHERE FileID = @FileID
- return
- |
- CREATE PROCEDURE [dbo].[DeleteInfoCategory] (@InfoCategoryID int) AS
- DELETE FROM InfoCategories WHERE InfoCategoryID = @InfoCategoryID
- return
- |
- CREATE PROCEDURE [dbo].[DeleteInfomation] (@InfoID int) AS
- DELETE FROM Infomation WHERE InfoID = @InfoID
- return
- |
- CREATE PROCEDURE [dbo].[DeleteJob] (@JobID int) AS
- DELETE FROM Job WHERE JobID = @JobID
- return
- |
- CREATE PROCEDURE [dbo].[DeleteMeeting] (@MeetingID int) AS
- DELETE FROM Meeting WHERE MeetingID = @MeetingID
- return
- |
- CREATE PROCEDURE [dbo].[DeleteNotification] (@NotificationID int) AS
- DELETE FROM Notification WHERE NotificationID = @NotificationID
- return
- |
- CREATE PROCEDURE [dbo].[DeleteOnlineUser] (@UserSN nvarchar(50)) AS
- DELETE FROM Online WHERE UserSN = @UserSN
- return
- |
- CREATE PROCEDURE [dbo].[DeleteOrganization] (@OrganizationID int) AS
- DELETE FROM Organization WHERE OrganizationID = @OrganizationID
- return
- |
- CREATE PROCEDURE [dbo].[DeletePerson] (@PersonID int) AS
- DELETE FROM Persons WHERE PersonID = @PersonID
- return
- |
- CREATE PROCEDURE [dbo].[DeleteSchedule] (@ScheduleID int) AS
- DELETE FROM Schedule WHERE ScheduleID = @ScheduleID
- return
- |
- CREATE PROCEDURE [dbo].[DeleteSenderMessage] (@MessageID int) AS
- DELETE FROM Message WHERE MessageID = @MessageID
- return
- |
- CREATE PROCEDURE [dbo].[DeleteSystem] (@SystemID int) AS
- DELETE FROM System WHERE SystemID = @SystemID
- return
- |
- CREATE Procedure [dbo].[DocumentContents] (@DocumentID int) AS
- SELECT * FROM Document WHERE DocumentID=@DocumentID
- return
- |
- CREATE PROCEDURE [dbo].[DocumentPrompt] (@AccepterID nvarchar(120)) AS
- SELECT * FROM Document WHERE AccepterID=@AccepterID AND state=0
- return
- |
- CREATE PROCEDURE [dbo].[FileContens] (@FileID INT) AS
- SELECT dbo.Files.[Date], dbo.Files.State, dbo.Files.FileKind, dbo.Files.Title,
- dbo.Files.Writer, dbo.Organization.OrganizationName, dbo.System.SystemName,
- dbo.Persons.Name, dbo.Files.Contents, dbo.Files.ContentType, dbo.Files.ByteSize
- FROM dbo.Files INNER JOIN
- dbo.Organization ON
- dbo.Files.OrganizationID = dbo.Organization.OrganizationID INNER JOIN
- dbo.System ON dbo.Files.SystemID = dbo.System.SystemID INNER JOIN
- dbo.Persons ON dbo.Files.PersonID = dbo.Persons.PersonID
- WHERE FileID=@FileID
- RETURN
- |
- CREATE PROCEDURE [dbo].[FileContents] (@FileID INT) AS
- SELECT dbo.Files.[Date], dbo.Files.State, dbo.Files.FileKind, dbo.Files.Title,
- dbo.Files.Writer, dbo.Organization.OrganizationName, dbo.System.SystemName,
- dbo.Persons.Name, dbo.Files.Contents, dbo.Files.ContentType, dbo.Files.ByteSize
- FROM dbo.Files INNER JOIN
- dbo.Organization ON
- dbo.Files.OrganizationID = dbo.Organization.OrganizationID INNER JOIN
- dbo.System ON dbo.Files.SystemID = dbo.System.SystemID INNER JOIN
- dbo.Persons ON dbo.Files.PersonID = dbo.Persons.PersonID
- WHERE FileID=@FileID
- RETURN
- |
- CREATE PROCEDURE [dbo].[FilePrompt] (@AccepterID nvarchar(120)) AS
- SELECT * FROM Files WHERE AccepterID LIKE '%('+@AccepterID+')%' AND state NOT LIKE '%('+@AccepterID+')%'
- return
- |
- CREATE procedure [dbo].[GetInfomation] (@pagesize int,@pageindex int,@InfoCategoryID int,@docount bit) AS
- set nocount on
- if(@docount=1)
- select count(InfoID) from Infomation where InfoCategoryID = @InfoCategoryID
- else
- begin
- declare @indextable table(InfoID int identity(1,1),nid int)
- declare @PageLowerBound int
- declare @PageUpperBound int
- set @PageLowerBound=(@pageindex-1)*@pagesize
- set @PageUpperBound=@PageLowerBound+@pagesize
- set rowcount @PageUpperBound
- insert into @indextable(nid) select InfoID from Infomation order by Date desc
- select O.InfoID,O.Writer,O.title,O.Date from Infomation O,@indextable t where O.InfoID=t.nid
- and t.InfoID>@PageLowerBound and t.InfoID<=@PageUpperBound and O.InfoCategoryID=@InfoCategoryID order by t.InfoID
- end
- set nocount off
- |
- CREATE PROCEDURE [dbo].[InfoCategorySelect] AS
- SELECT dbo.InfoCategories.*, dbo.Organization.OrganizationName AS Expr1
- FROM dbo.InfoCategories INNER JOIN
- dbo.Organization ON
- dbo.InfoCategories.OrganizationID = dbo.Organization.OrganizationID
- return
- |
- CREATE Procedure [dbo].[InfomationContents] (@InfoID int) AS
- SELECT dbo.Infomation.InfoID, dbo.Infomation.Writer, dbo.Infomation.Title,
- dbo.Infomation.Contents, dbo.Infomation.[Date], dbo.Infomation.State,
- dbo.Infomation.InfoCategoryID, dbo.Persons.Name
- FROM dbo.Infomation INNER JOIN
- dbo.Persons ON dbo.Infomation.PersonID = dbo.Persons.PersonID WHERE InfoID=@InfoID
- return
- |
- CREATE PROCEDURE [dbo].[InsertDocument] (@Title nvarchar(100),@Contents image,@PersonID int,@AccepterID nvarchar(500),@State char(10),@Process nvarchar(500),@WriterID nvarchar(50)) AS
- Insert into Document(Title,Contents,PersonID,AccepterID,Date,State,Process,WriterID) values (@Title,@Contents,@PersonID,@AccepterID,GETDATE(),@State,@Process,@WriterID)
- return
- |
- CREATE PROCEDURE [dbo].[InsertFile] (@Title nvarchar(50),@Contents image,@PersonID int,@AccepterID nvarchar(500),@State int,@ContentType nvarchar(50),@ByteSize nvarchar(50),@SystemID int,@OrganizationID int,@FileKind nvarchar(50)) AS
- Insert into Files(Title,Contents,PersonID,AccepterID,Date,State,ContentType,ByteSize,SystemID,OrganizationID,FileKind) values (@Title,@Contents,@PersonID,@AccepterID,GETDATE(),@State,@ContentType,@ByteSize,@SystemID,@OrganizationID,@FileKind)
- return
- |
- CREATE PROCEDURE [dbo].[InsertInfo] (@Title nvarchar(80),@Contents image,@PersonID int,@Writer nvarchar(50),@InfoCategoryID int) AS
- Insert into Infomation(Title,Contents,PersonID,InfoCategoryID,Date,State,Writer) values (@Title,@Contents,@PersonID,@InfoCategoryID,GETDATE(),0,@Writer)
- return
- |
- CREATE PROCEDURE [dbo].[InsertInfoCategory](@InfoCategoryName nvarchar(50),@OrganizationID int) AS
- Insert into InfoCategories(InfoCategoryName,OrganizationID) values (@InfoCategoryName,@OrganizationID)
- return
- |
- CREATE PROCEDURE [dbo].[InsertJob] (@JobName nvarchar(50)) AS
- Insert into Job(JobName) values (@JobName)
- return
- |
- CREATE PROCEDURE [dbo].[InsertMeeting] (@Title nvarchar(100),@Caller nvarchar(50), @AccepterID nvarchar(500),@Address nvarchar(50),@Attends nvarchar(500),@State nvarchar(120),@MeetingDate nvarchar(50),@PersonID int) AS
- Insert into Meeting(Title,Caller,AccepterID,Date,State,MeetingDate,Address,Attends,PersonID,Result) values (@Title,@Caller,@AccepterID,GETDATE(),@State,@MeetingDate,@Address,@Attends,@PersonID,0)
- return
- |
- CREATE PROCEDURE [dbo].[InsertMessage] (@Contents nvarchar(1000),@PersonID int,@AccepterID nvarchar(500),@State int,@Attachment nvarchar(50)) AS
- Insert into Message(Contents,PersonID,AccepterID,Date,State,Attachment) values (@Contents,@PersonID,@AccepterID,GETDATE(),@State,@Attachment)
- return
- |
- CREATE PROCEDURE [dbo].[InsertNotification] (@Contents nvarchar(200),@PersonID int) AS
- Insert into Notification(Contents,PersonID,Date,State) values (@Contents,@PersonID,GETDATE(),0)
- return
- |
- CREATE PROCEDURE [dbo].[InsertOnlineUser] (@UserName nvarchar(50),@UserSN nvarchar(50)) AS
- Insert into Online(UserName,UserSN,Date) values (@UserName,@UserSN,GETDATE())
- return
- |
- CREATE PROCEDURE [dbo].[InsertOrganization] (@OrganizationName nvarchar(50),@SystemID nvarchar(50)) AS
- Insert into Organization(OrganizationName,SystemID) values (@OrganizationName,@SystemID)
- return
- |
- CREATE PROCEDURE [dbo].[InsertPerson] (@Name nvarchar(100),@OrganizationID nvarchar(50), @JobID nvarchar(50),@Password nvarchar(50)) AS
- Insert into Persons(Name,OrganizationID,JobID,Password) values (@Name,@OrganizationID,@JobID,@Password)
- return
- |
- CREATE PROCEDURE [dbo].[InsertSchedule] (@Contents nvarchar(200),@PlanTime Datetime,@State int,@PersonID int) AS
- Insert into Schedule(Contents,PlanTime,Date,State,PersonID,Result) values (@Contents,@PlanTime,GETDATE(),@State,@PersonID,0)
- return
- |
- CREATE PROCEDURE [dbo].[InsertSystem] (@SystemName nvarchar(50)) AS
- Insert into System(SystemName) values (@SystemName)
- return
- |
- CREATE Procedure [dbo].[JobName] (@JobID int) AS
- SELECT * FROM Job WHERE JobID=@JobID
- return
- |
- CREATE Procedure [dbo].[JobSelect] AS
- SELECT * FROM Job ORDER BY JobID ASC
- return
- |
- CREATE Procedure [dbo].[ManageJob] AS
- SELECT * FROM Job WHERE JobName NOT LIKE '系统管理员' AND JobName NOT LIKE '文件管理员' ORDER BY JobID ASC
- return
- |
- CREATE Procedure [dbo].[MeetingContents] (@MeetingID int) AS
- SELECT * FROM Meeting WHERE MeetingID=@MeetingID
- return
- |
- CREATE PROCEDURE [dbo].[MeetingPrompt] (@AccepterID nvarchar(120)) AS
- SELECT * FROM Meeting WHERE State NOT LIKE '%('+@AccepterID+')%' AND AccepterID LIKE '%('+@AccepterID+')%'
- |
- CREATE Procedure [dbo].[MessageContents] (@MessageID int) AS
- SELECT * FROM Message WHERE MessageID=@MessageID
- return
- |
- CREATE PROCEDURE [dbo].[MessagePrompt] (@AccepterID nvarchar(120),@State int = null) AS
- IF isnull(@State,0) = 0
- Begin
- SELECT * FROM Message WHERE AccepterID = @AccepterID AND State =0
- End
- ELSE
- BEGIN
- SELECT * FROM Message WHERE AccepterID = @AccepterID AND State = @State
- END
- return
- |
- CREATE PROCEDURE [dbo].[NotificationPrompt] AS
- SELECT * FROM Notification WHERE State = 0
- return
- |
- CREATE Procedure [dbo].[OnlineUser] AS
- SELECT * FROM Online ORDER BY Date DESC
- return
- |
- CREATE Procedure [dbo].[OrganizationName] (@OrganizationID INT) AS
- SELECT * FROM Organization WHERE OrganizationID = @OrganizationID
- return
- |
- CREATE Procedure [dbo].[OrganizationSelect] AS
- SELECT * FROM Organization ORDER BY OrganizationID ASC
- return
- |
- CREATE Procedure [dbo].[PersonID] (@Name nvarchar(50)) AS
- SELECT * FROM Persons WHERE Name=@Name
- return
- |
- CREATE Procedure [dbo].[PersonID0] (@Name nvarchar(50),@Password nvarchar(50)) AS
- SELECT * FROM Persons WHERE Name=@Name AND Password=@Password
- return
- |
- CREATE Procedure [dbo].[PersonIDTree] (@Name nvarchar(50),@JobID nvarchar(50)) AS
- SELECT * FROM Persons WHERE Name<>@Name AND JobID LIKE '%'+@JobID+'%' ORDER BY PersonID ASC
- return
- |
- CREATE Procedure [dbo].[PersonIDTree0] (@JobID nvarchar(50)) AS
- SELECT * FROM Persons WHERE JobID LIKE '%'+@JobID+'%' ORDER BY PersonID ASC
- return
- |
- CREATE Procedure [dbo].[PersonName] (@PersonID int) AS
- SELECT * FROM Persons WHERE PersonID=@PersonID
- return
- |
- CREATE PROCEDURE [dbo].[PromptSchedule] (@PersonID INT) AS
- SELECT * FROM Schedule WHERE DATEPART(dayofyear,PlanTime) = DATEPART(dayofyear, getdate()) AND PlanTime>getdate() AND Result=0 AND PersonID=@PersonID
- RETURN
- |
- CREATE PROCEDURE [dbo].[PromptSchedule1] (@PersonID INT) AS
- SELECT * FROM Schedule WHERE PlanTime<getdate() AND Result=0 AND PersonID=@PersonID
- RETURN
- |
- CREATE PROCEDURE [dbo].[SelectALLInfomation] AS
- SELECT dbo.InfoCategories.InfoCategoryName, dbo.Persons.Name, dbo.Infomation.InfoID,
- dbo.Infomation.Writer, dbo.Infomation.Title,
- dbo.Infomation.[Date], dbo.Infomation.State
- FROM dbo.Infomation INNER JOIN
- dbo.Persons ON dbo.Infomation.PersonID = dbo.Persons.PersonID INNER JOIN
- dbo.InfoCategories ON
- dbo.Infomation.InfoCategoryID = dbo.InfoCategories.InfoCategoryID ORDER BY dbo.Infomation.InfoID DESC
- return
- |
- CREATE PROCEDURE [dbo].[SelectAllDocument] AS
- SELECT * FROM Document
- return
- |
- CREATE PROCEDURE [dbo].[SelectAllFile] AS
- SELECT * FROM Files ORDER BY FileID
- return
- |
- CREATE PROCEDURE [dbo].[SelectAllMeeting] AS
- SELECT * FROM Meeting ORDER BY MeetingID
- return
- |
- CREATE PROCEDURE [dbo].[SelectAllMessage] AS
- SELECT * FROM Message ORDER BY MessageID
- return
- |
- CREATE PROCEDURE [dbo].[SelectAllNotification] AS
- SELECT * FROM Notification ORDER BY NotificationID DESC
- return
- |
- CREATE PROCEDURE [dbo].[SelectAllSchedule] AS
- SELECT * FROM Schedule
- return
- |
- CREATE Procedure [dbo].[SelectFileManager] AS
- SELECT * FROM Job WHERE JobName='文件管理员'
- return
- |
- CREATE Procedure [dbo].[SelectInfoCategories] AS
- SELECT * FROM InfoCategories ORDER BY InfoCategoryID ASC
- return
- |
- CREATE Procedure [dbo].[SelectInfoCategoryName] (@InfoCategoryID int) AS
- SELECT InfoCategoryName FROM InfoCategories WHERE InfoCategoryID=@InfoCategoryID
- return
- |
- CREATE PROCEDURE [dbo].[SelectInfoCount] AS
- select Count(*) from Infomation
- return
- |
- CREATE Procedure [dbo].[SelectMessageAttachment] (@MessageID int) AS
- SELECT Attachment FROM Message WHERE MessageID=@MessageID
- return
- |
- CREATE PROCEDURE [dbo].[SelectMyChechedDocument] (@CheckedMarker NVARCHAR(120)) AS
- SELECT * FROM Document WHERE CheckedMarker LIKE '%('+@CheckedMarker+')%'
- return
- |
- CREATE PROCEDURE [dbo].[SelectMyDocument] (@WriterID NVARCHAR(50)) AS
- SELECT * FROM Document WHERE WriterID = @WriterID
- return
- |
- CREATE PROCEDURE [dbo].[SelectMySchedule] (@PersonID int) AS
- SELECT * FROM Schedule WHERE PersonID = @PersonID
- return
- |
- CREATE Procedure [dbo].[SelectNotification](@NotificationID int) AS
- SELECT * FROM Notification WHERE NotificationID = @NotificationID
- return
- |
- CREATE Procedure [dbo].[SelectOrganization] (@SystemID nvarchar(50),@TypeID int) AS
- SELECT * FROM Organization WHERE SystemID LIKE @SystemID AND TypeID=@TypeID ORDER BY OrganizationID ASC
- return
- |
- CREATE Procedure [dbo].[SelectOrganization0] (@SystemID nvarchar(50)) AS
- SELECT * FROM Organization WHERE SystemID LIKE '%'+@SystemID+ '%' ORDER BY OrganizationID ASC
- return
- |
- CREATE Procedure [dbo].[SelectOrganizationName] (@OrganizationID int) AS
- SELECT * FROM Organization WHERE OrganizationID=@OrganizationID
- return
- |
- CREATE PROCEDURE [dbo].[SelectPendingDocument] (@AccepterID NVARCHAR(120)) AS
- SELECT * FROM Document WHERE AccepterID=@AccepterID
- return
- |
- CREATE PROCEDURE [dbo].[SelectReceiveFile] (@AccepterID NVARCHAR(120)) AS
- SELECT * FROM Files WHERE AccepterID LIKE '%('+@AccepterID+')%'
- return
- |
- CREATE PROCEDURE [dbo].[SelectReceiveMeeting] (@AccepterID NVARCHAR(120)) AS
- SELECT * FROM Meeting WHERE AccepterID LIKE '%('+@AccepterID+')%'
- return
- |
- CREATE PROCEDURE [dbo].[SelectReceiveMessage] (@AccepterID NVARCHAR(120)) AS
- SELECT * FROM Message WHERE AccepterID=@AccepterID
- return
- |
- CREATE PROCEDURE [dbo].[SelectSenderMessage] (@PersonID int) AS
- SELECT * FROM Message WHERE PersonID = @PersonID AND AccepterID LIKE '(%'
- return
- |
- CREATE Procedure [dbo].[SelectSystemManager] AS
- SELECT * FROM Job WHERE JobName='系统管理员'
- return
- |
- CREATE Procedure [dbo].[SelectSystemName] (@SystemID int) AS
- SELECT * FROM System WHERE SystemID=@SystemID
- return
- |
- CREATE PROCEDURE [dbo].[SelectTopInfo] (@InfoCategoryID int) AS
- select Top 6 * from Infomation where InfoCategoryID = @InfoCategoryID ORDER BY Date DESC
- return
- |
- CREATE Procedure [dbo].[SystemSelect] AS
- SELECT * FROM System ORDER BY SystemID ASC
- return
- |
- CREATE PROCEDURE [dbo].[UpdateDocument](@DocumentID int,@State char(10),@Result nvarchar(4000),@AccepterID nvarchar(500),@PersonID int,@CheckedMarker nvarchar(120)) AS
- UPDATE Document SET State = @State, Result=@Result,AccepterID=@AccepterID,PersonID=@PersonID,CheckedMarker=@CheckedMarker where DocumentID = @DocumentID
- return
- |
- CREATE PROCEDURE [dbo].[UpdateDocumentState](@DocumentID int,@State char(10),@Result nvarchar(4000),@AccepterID nvarchar(500)) AS
- UPDATE Document SET State = @State, Result=@Result,AccepterID=@AccepterID where DocumentID = @DocumentID
- return
- |
- CREATE PROCEDURE [dbo].[UpdateFileState](@FileID int,@State nvarchar(120)) AS
- UPDATE Files SET State = @State where FileID = @FileID
- return
- |
- CREATE PROCEDURE [dbo].[UpdateInfoCategory](@InfoCategoryName NVARCHAR(50),@InfoCategoryID int,@OrganizationID int) AS
- UPDATE InfoCategories SET InfoCategoryName= @InfoCategoryName,OrganizationID = @OrganizationID where InfoCategoryID = @InfoCategoryID
- return
- |
- CREATE PROCEDURE [dbo].[UpdateInfomation](@InfoID int,@PersonID int,@Title nvarchar(80),@Contents image,@Writer nvarchar(50),@InfoCategoryID int) AS
- UPDATE Infomation SET PersonID=@PersonID, Title=@Title, Contents=@Contents,Writer=@Writer,InfoCategoryID=@InfoCategoryID,Date=GETDATE() where InfoID = @InfoID
- return
- |
- CREATE PROCEDURE [dbo].[UpdateInfomationState](@InfoID int,@State int) AS
- UPDATE Infomation SET State = @State
- where InfoID = @InfoID
- return
- |
- CREATE PROCEDURE [dbo].[UpdateJob](@JobName NVARCHAR(50),@JobID int) AS
- UPDATE Job SET JobName= @JobName where JobID = @JobID
- return
- |
- CREATE PROCEDURE [dbo].[UpdateMeetingResult](@MeetingID int,@Result nvarchar(10)) AS
- UPDATE Meeting SET Result = @Result
- where MeetingID = @MeetingID
- return
- |
- CREATE PROCEDURE [dbo].[UpdateMeetingState](@MeetingID int,@State nvarchar(500)) AS
- UPDATE Meeting SET State = @State ,ReadTime=GETDATE()
- where MeetingID = @MeetingID
- return
- |
- CREATE PROCEDURE [dbo].[UpdateMessageState](@MessageID int,@State int) AS
- UPDATE Message SET State = @State,ReadTime=GETDATE()
- where MessageID = @MessageID
- return
- |
- CREATE PROCEDURE [dbo].[UpdateNotificationState](@NotificationID int) AS
- update Notification set State = 1 where NotificationID = @NotificationID
- return
- |
- CREATE PROCEDURE [dbo].[UpdateOnlineUser](@UserSN NVARCHAR(50),@UserName NVARCHAR(50)) AS
- UPDATE Online SET UserSN = @UserSN, Date =GETDATE() where UserName=@UserName
- return
- |
- CREATE PROCEDURE [dbo].[UpdateOrganization](@OrganizationID int,@OrganizationName NVARCHAR(50),@SystemID NVARCHAR(50)) AS
- UPDATE Organization SET OrganizationName= @OrganizationName,SystemID = @SystemID where OrganizationID=@OrganizationID
- return
- |
- CREATE PROCEDURE [dbo].[UpdatePerson](@PersonID int,@Name NVARCHAR(50),@OrganizationID NVARCHAR(50),@JobID NVARCHAR(50)) AS
- UPDATE Persons SET Name= @Name,OrganizationID = @OrganizationID, JobID = @JobID where PersonID=@PersonID
- return
- |
- CREATE PROCEDURE [dbo].[UpdatePersonFriend](@PersonID int,@Friends NVARCHAR(200)) AS
- UPDATE Persons SET Friends= @Friends where PersonID=@PersonID
- return
- |
- CREATE PROCEDURE [dbo].[UpdatePersonPass](@PersonID int,@Password NVARCHAR(50)) AS
- UPDATE Persons SET Password=@Password ,State = '0' where PersonID=@PersonID
- return
- |
- CREATE PROCEDURE [dbo].[UpdatePersonRegisterInfo](@PersonID int,@Password NVARCHAR(50),@Phoneo NVARCHAR(50),@Phonef NVARCHAR(50),@Mobile NVARCHAR(50),@Address NVARCHAR(50)) AS
- UPDATE Persons SET Password=@Password ,Phoneo = @Phoneo,Phonef = @Phonef,Mobile = @Mobile,Address = @Address where PersonID=@PersonID
- return
- |
- CREATE PROCEDURE [dbo].[UpdateScheduleResult](@ScheduleID int,@Result nvarchar(10)) AS
- UPDATE Schedule SET Result = @Result
- where ScheduleID = @ScheduleID
- return
- |
- CREATE PROCEDURE [dbo].[UpdateSystem](@SystemName NVARCHAR(50),@SystemID int) AS
- UPDATE System SET SystemName= @SystemName where SystemID = @SystemID
- return
- |
- CREATE PROCEDURE [dbo].[ViewMessageState] (@Contents nvarchar(1000),@PersonID INT,@AccepterID NVARCHAR(500)) AS
- SELECT State,ReadTime FROM Message WHERE Contents=@Contents AND PersonID= @PersonID AND AccepterID= @AccepterID
- return
- |
- Insert into Job(JobName) values ('系统管理员');
- |
- Insert into Job(JobName) values ('文件管理员');
- |
- Insert into Persons(Name,JobID,Password) values ('Admin',1,'7DDCC5C9FA4B0CEDFA1E385FEDB908EE');