use master
go
if exists (select * from dbo.sysdatabases where name = 'Personnel')
drop database Personnel
GO
create database Personnel
go
use Personnel
go
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[annuities]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[annuities]
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[checkin]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[checkin]
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[manappraise]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[manappraise]
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[manrecord]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[manrecord]
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[medical]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[medical]
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[pay]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[pay]
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[payrecord]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[payrecord]
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[paytune]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[paytune]
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[room]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[room]
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[user_Info1]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[user_Info1]
GO
CREATE TABLE [dbo].[annuities] (
[jjid] [varchar] (8) COLLATE Chinese_PRC_CI_AS NOT NULL ,
[jjname] [varchar] (10) COLLATE Chinese_PRC_CI_AS NOT NULL ,
[jjbase] [numeric](10, 2) NULL ,
[jjrate1] [numeric](6, 4) NULL ,
[jjoffice] [numeric](8, 2) NULL ,
[jjrate2] [numeric](6, 4) NULL ,
[jjown] [numeric](8, 2) NULL ,
[jjrate3] [numeric](6, 4) NULL ,
[jjsociety] [numeric](8, 2) NULL ,
[jjindivi] [numeric](8, 2) NULL ,
[jjfill] [numeric](8, 2) NULL ,
[jjdate] [datetime] NOT NULL
) ON [PRIMARY]
GO
CREATE TABLE [dbo].[checkin] (
[kqid] [varchar] (8) COLLATE Chinese_PRC_CI_AS NOT NULL ,
[kqname] [varchar] (10) COLLATE Chinese_PRC_CI_AS NOT NULL ,
[kqdate] [datetime] NOT NULL ,
[kqdays] [bigint] NOT NULL ,
[kqrday] [numeric](2, 0) NULL ,
[kqtday] [numeric](2, 0) NOT NULL ,
[kqwork] [numeric](2, 0) NOT NULL ,
[kqabsent] [numeric](2, 0) NULL ,
[kqrest] [numeric](2, 0) NULL ,
[kqleave] [numeric](2, 0) NULL ,
[kqlate] [numeric](2, 0) NULL ,
[kqearly] [numeric](2, 0) NULL ,
[kqforget] [numeric](2, 0) NULL ,
[kqover1] [numeric](2, 0) NULL ,
[kqvoer2] [numeric](2, 0) NULL ,
[kqfill] [numeric](2, 0) NULL ,
[kqgo] [numeric](2, 0) NULL ,
[kqpay] [numeric](8, 2) NULL ,
[kqdeduct] [numeric](8, 2) NULL ,
[kqother] [varchar] (20) COLLATE Chinese_PRC_CI_AS NULL ,
[kqremark] [text] COLLATE Chinese_PRC_CI_AS NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
CREATE TABLE [dbo].[manappraise] (
[pjdept] [varchar] (10) COLLATE Chinese_PRC_CI_AS NOT NULL ,
[pjname] [varchar] (10) COLLATE Chinese_PRC_CI_AS NOT NULL ,
[pjno] [char] (14) COLLATE Chinese_PRC_CI_AS NOT NULL ,
[pjid] [varchar] (8) COLLATE Chinese_PRC_CI_AS NOT NULL ,
[pjdate] [datetime] NOT NULL ,
[pjresult] [varchar] (40) COLLATE Chinese_PRC_CI_AS NULL ,
[pjposition] [varchar] (40) COLLATE Chinese_PRC_CI_AS NULL ,
[pjlevel] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
[pjremark] [text] COLLATE Chinese_PRC_CI_AS NULL ,
[pjother1] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
[pjother2] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
CREATE TABLE [dbo].[manrecord] (
[ygid] [varchar] (8) COLLATE Chines�