數(shù)據(jù)庫(kù)設(shè)計(jì)文檔模板_第1頁(yè)
數(shù)據(jù)庫(kù)設(shè)計(jì)文檔模板_第2頁(yè)
數(shù)據(jù)庫(kù)設(shè)計(jì)文檔模板_第3頁(yè)
數(shù)據(jù)庫(kù)設(shè)計(jì)文檔模板_第4頁(yè)
數(shù)據(jù)庫(kù)設(shè)計(jì)文檔模板_第5頁(yè)
已閱讀5頁(yè),還剩19頁(yè)未讀 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

1、DR-RD-020(V1.1)數(shù)據(jù)庫(kù)設(shè)計(jì)說(shuō)明書(shū)數(shù)據(jù)庫(kù)設(shè)計(jì)說(shuō)明書(shū)(內(nèi)部資料 請(qǐng)勿外傳)編編 寫(xiě):寫(xiě):日日 期:期:檢檢 查:查:日日 期:期:審審 核:核:日日 期:期:批批 準(zhǔn):準(zhǔn):日日 期:期: *版權(quán)所有版權(quán)所有 不得復(fù)制不得復(fù)制文檔編號(hào)文檔編號(hào)2011-6-14版本版本A1密級(jí)密級(jí)商密A項(xiàng)目名稱項(xiàng)目名稱時(shí)代集團(tuán)產(chǎn)品跟蹤平臺(tái)*中心開(kāi)發(fā)部中心開(kāi)發(fā)部項(xiàng)目來(lái)源項(xiàng)目來(lái)源時(shí)代集團(tuán)時(shí)代集團(tuán)產(chǎn)品跟蹤平臺(tái)時(shí)代集團(tuán)產(chǎn)品跟蹤平臺(tái) .1數(shù)據(jù)庫(kù)設(shè)計(jì)說(shuō)明書(shū)數(shù)據(jù)庫(kù)設(shè)計(jì)說(shuō)明書(shū) .11引言引言.21.1編寫(xiě)目的.21.2術(shù)語(yǔ)表.21.3參考資料.32數(shù)據(jù)庫(kù)環(huán)境說(shuō)明數(shù)據(jù)庫(kù)環(huán)境說(shuō)明.33數(shù)據(jù)庫(kù)的命名規(guī)則數(shù)據(jù)庫(kù)的命名規(guī)則.34

2、邏輯設(shè)計(jì)邏輯設(shè)計(jì).35物理設(shè)計(jì)物理設(shè)計(jì).45.1表匯總.45.2表X:XXX 表.45.3視圖的設(shè)計(jì).65.4存儲(chǔ)過(guò)程、函數(shù)及觸發(fā)器的設(shè)計(jì).66安全性設(shè)計(jì)安全性設(shè)計(jì).66.1防止用戶直接操作數(shù)據(jù)庫(kù)的方法.66.2用戶帳號(hào)密碼的加密方法.76.3角色與權(quán)限.77優(yōu)化優(yōu)化.78數(shù)據(jù)庫(kù)管理與維護(hù)說(shuō)明數(shù)據(jù)庫(kù)管理與維護(hù)說(shuō)明.71引言引言1.1編寫(xiě)目的編寫(xiě)目的本文檔是時(shí)代集團(tuán)產(chǎn)品跟蹤平臺(tái)概要設(shè)計(jì)文檔的組成部分,編寫(xiě)數(shù)據(jù)庫(kù)設(shè)計(jì)文檔的目的是:明確數(shù)據(jù)庫(kù)的表名、字段名等數(shù)據(jù)信息,用來(lái)指導(dǎo)后期的數(shù)據(jù)庫(kù)腳本的開(kāi)發(fā),本文檔遵循SQL 數(shù)據(jù)庫(kù)設(shè)計(jì)和開(kāi)發(fā)規(guī)范 。本文檔的讀者對(duì)象是需求人員、系統(tǒng)設(shè)計(jì)人員、開(kāi)發(fā)人員、測(cè)試人員

3、。1.2術(shù)語(yǔ)表術(shù)語(yǔ)表序號(hào)序號(hào)術(shù)語(yǔ)或縮略語(yǔ)術(shù)語(yǔ)或縮略語(yǔ)說(shuō)明性定義說(shuō)明性定義1ESIDEnterStorageId 入庫(kù)編號(hào)2ProIdProductId 產(chǎn)品編號(hào)3PMIDProductManagerId 產(chǎn)品管理員編號(hào)1.3參考資料參考資料資料名稱作者文件編號(hào)、版本資料存放地點(diǎn)2數(shù)據(jù)庫(kù)環(huán)境說(shuō)明數(shù)據(jù)庫(kù)環(huán)境說(shuō)明數(shù)據(jù)庫(kù)實(shí)例數(shù)據(jù)庫(kù)系統(tǒng)數(shù)據(jù)庫(kù)部署環(huán)境數(shù)據(jù)庫(kù)設(shè)計(jì)工具數(shù)據(jù)庫(kù)存放位置說(shuō)明3數(shù)據(jù)庫(kù)的命名規(guī)則數(shù)據(jù)庫(kù)的命名規(guī)則數(shù)據(jù)庫(kù)名稱:時(shí)代集團(tuán)的英文名稱time-group表名:英文(表的用途)+下劃線+英文字段名:相關(guān)屬性的英文名 4邏輯設(shè)計(jì)邏輯設(shè)計(jì)提示:數(shù)據(jù)庫(kù)設(shè)計(jì)人員根據(jù)需求文檔,創(chuàng)建與數(shù)據(jù)庫(kù)相關(guān)的那部分實(shí)體

4、關(guān)系圖(ERD) 。如果采用面向?qū)ο蠓椒ǎ∣OAD) ,這里實(shí)體相當(dāng)于類(class) 。inhr_partner_spinhr_partner_cppartner_sett_relscoop_relssettle_order_relspartner_sett_ordercoop_settl_ordersp_coop_relscp_coop_rels伙 伙 伙 伙伙 伙 伙 伙 伙伙 伙 伙 伙 伙伙 伙 伙 1伙 伙 伙 伙伙 伙 伙伙 伙 伙 伙伙 伙 伙 伙伙 伙 伙 25物理設(shè)計(jì)物理設(shè)計(jì)提示:(1)主要是設(shè)計(jì)表結(jié)構(gòu)。一般地,實(shí)體對(duì)應(yīng)于表,實(shí)體的屬性對(duì)應(yīng)于表的列,實(shí)體之間的關(guān)系成為表的約

5、束。邏輯設(shè)計(jì)中的實(shí)體大部分可以轉(zhuǎn)換成物理設(shè)計(jì)中的表,但是它們并不一定是一一對(duì)應(yīng)的。(2)對(duì)表結(jié)構(gòu)進(jìn)行規(guī)范化處理(第三范式) 。5.1表匯總表匯總表名功能說(shuō)明Enter_storage產(chǎn)品入庫(kù)(新產(chǎn)品的登記、修改、查詢)Exit_storage產(chǎn)品出庫(kù)(登記產(chǎn)品出庫(kù)信息)Seller_info銷(xiāo)售商信息維護(hù)表(對(duì)銷(xiāo)售商信息的添加、修改和查詢)Product_info產(chǎn)品信息表(對(duì)新產(chǎn)品的發(fā)布,修改,查詢等維護(hù))Repair_info維修表(對(duì)已出售產(chǎn)品的維修進(jìn)行登記,修改)L管理員表(包含五種身份,銷(xiāo)售人員,庫(kù)存管理人員,售后服務(wù)人員,產(chǎn)品信息管理人員,系統(tǒng)管理員)5.2表:表的索引: 索引是否

6、建立要根據(jù)具體的業(yè)務(wù)需求來(lái)確定。允許為空:不填的表示為“是” 。唯一:不填的表示為“是” 。表的記錄數(shù)和增長(zhǎng)量:根據(jù)具體的業(yè)務(wù)需求確定。增長(zhǎng)量應(yīng)確定單位時(shí)間如果量大可以按每天,如果不大可以按每月。表字段的區(qū)別度:主要是考慮到將來(lái)在此字段上建立索引類型選擇時(shí)作為參考,當(dāng)字段值唯一時(shí)可以不考慮,當(dāng)字段值不唯一時(shí),估算一個(gè)區(qū)別度,近似即可。例如:如果一個(gè)表的 NAME 字段有共 2000 個(gè)值,其中有 1999 個(gè)不同值,1999/2000=0.99 越接近 1 區(qū)別度越高,反之區(qū)別度越低。表的并發(fā):根據(jù)具體的業(yè)務(wù)需求預(yù)測(cè)表的并發(fā)。1表名Enter_storage數(shù)據(jù)庫(kù)用戶庫(kù)存管理人員主鍵ESID

7、入庫(kù)產(chǎn)品編號(hào)其他排序字段Product,date,num,storageManagerId索引字段序號(hào)字段名稱數(shù)據(jù)類型(精度范圍)允許為空 Y/N唯一Y/N區(qū)別度默認(rèn)值約束條件/說(shuō)明1ESIDintNY2ProductVarchar(50)NN3dateSmallDateTimeNN4numVarchar(50)NN5storageManagerIdVarchar(50)NYMysql 腳本CREATE TABLE dbo.Enter_storage(ESID int IDENTITY(1,1) NOT NULL,product varchar(50) NOT NULL,date smalld

8、atetime NOT NULL,num varchar(6) NOT NULL,storageManagerId nvarchar(50) NOT NULL, CONSTRAINT PK_addStorage PRIMARY KEY CLUSTERED (ESID ASC)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON PRIMARY) ON PRIMARYGOSET ANSI_PADDING O

9、FFGO記錄數(shù)增長(zhǎng)量表的并發(fā)補(bǔ)充說(shuō)明2.2.表名Exit_storage數(shù)據(jù)庫(kù)用戶庫(kù)存管理人員主鍵ExitStorageId 出庫(kù)產(chǎn)品編號(hào)其他排序字段Product,date,num,storageManagerId索引字段序號(hào)字段名稱數(shù)據(jù)類型(精度范圍)允許為空 Y/N唯一Y/N區(qū)別度默認(rèn)值約束條件/說(shuō)明1ExitStorageIdintNY2ProductVarchar(50)NN3dateSmallDateTimeNN4numVarchar(50)NN5storageManagerIdVarchar(50)NYMysql 腳本CREATE TABLE dbo.Exit_storage(E

10、xitStorageId int IDENTITY(1,1) NOT NULL,product varchar(50) NOT NULL,date smalldatetime NOT NULL,num varchar(6) NOT NULL, CONSTRAINT PK_subStorage PRIMARY KEY CLUSTERED (ExitStorageId ASC)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCK

11、S = ON) ON PRIMARY) ON PRIMARYGOSET ANSI_PADDING OFFGO/* Object: Table dbo.Enter_storage Script Date: 01/17/2011 16:00:59 */SET ANSI_NULLS ONGOSET QUOTED_IDENTIFIER ONGOSET ANSI_PADDING ONGO記錄數(shù)增長(zhǎng)量表的并發(fā)補(bǔ)充說(shuō)明3.3.表名Seller_info數(shù)據(jù)庫(kù)用戶銷(xiāo)售商管理員主鍵name 其他排序字段telephone,address,product, stockNum,stockDate,stockPric

12、e索引字段序號(hào)字段名稱數(shù)據(jù)類型(精度范圍)允許為空 Y/N唯一Y/N區(qū)別度默認(rèn)值約束條件/說(shuō)明1nameVarchar(50)NY2telephoneVarchar(50)NN3addressSmallDateTimeNN4productVarchar(50)NN5stockNumVarchar(50)NN6stockDateSmallDateTimeNN7stockPriceVarchar(50)NNMysql 腳本CREATE TABLE dbo.Seller_info(name varchar(50) NOT NULL,telephone varchar(20) NOT NULL,add

13、ress varchar(50) NOT NULL,product varchar(50) NOT NULL,stockNum varchar(6) NOT NULL,stockDate smalldatetime NOT NULL,stockPrice varchar(10) NOT NULL, CONSTRAINT PK_maketer_Info PRIMARY KEY CLUSTERED (name ASC)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS

14、= ON, ALLOW_PAGE_LOCKS = ON) ON PRIMARY) ON PRIMARYGOSET ANSI_PADDING OFFGO/* Object: Table dbo.Repair_info Script Date: 12/16/2010 09:59:13 */SET ANSI_NULLS ONGOSET QUOTED_IDENTIFIER ONGOSET ANSI_PADDING ONGO記錄數(shù)增長(zhǎng)量表的并發(fā)補(bǔ)充說(shuō)明4.4. 表名Product_info數(shù)據(jù)庫(kù)用戶產(chǎn)品信息管理人員主鍵proId其他排序字段name,price,proDate, storage索引字段序

15、號(hào)字段名稱數(shù)據(jù)類型(精度范圍)允許為空 Y/N唯一Y/N區(qū)別度默認(rèn)值約束條件/說(shuō)明1proIdintNY2nameVarchar(50)NN3priceVarchar(50)NN4proDateSmallDateTime NN5storageVarchar(50)NYMysql 腳本CREATE TABLE dbo.Product_info(proId int IDENTITY(1,1) NOT NULL,name varchar(50) NOT NULL,price varchar(6) NOT NULL,proDate smalldatetime NOT NULL,storage varc

16、har(4) NOT NULL, CONSTRAINT PK_product_Info PRIMARY KEY CLUSTERED (proId ASC)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON PRIMARY) ON PRIMARYGOSET ANSI_PADDING OFFGO/* Object: Table dbo.Login Script Date: 01/17/2011 16:00:

17、59 */SET ANSI_NULLS ONGOSET QUOTED_IDENTIFIER ONGOSET ANSI_PADDING ONGO記錄數(shù)增長(zhǎng)量表的并發(fā)補(bǔ)充說(shuō)明5.5.表名Repair_info數(shù)據(jù)庫(kù)用戶售后服務(wù)人員主鍵repairId 產(chǎn)品維修編號(hào)其他排序字段repairName,repairtel,product, customer,date,customertel索引字段序號(hào)字段名稱數(shù)據(jù)類型(精度范圍)允許為空 Y/N唯一Y/N區(qū)別度默認(rèn)值約束條件/說(shuō)明1repairIdintNY2repairNameVarchar(50)NN3repairtelSmallDateTimeNN

18、4productVarchar(50)NN5customerVarchar(50)NNdateSmallDateTimeNNcustomertelVarchar(50)NNMysql 腳本CREATE TABLE dbo.Repair_info(repairId int IDENTITY(1,1) NOT NULL,repairName nchar(10) NULL,repairtel nchar(10) NULL,product varchar(50) NOT NULL,customer varchar(20) NOT NULL,date smalldatetime NOT NULL,cus

19、tomertel nchar(10) NULL, CONSTRAINT PK_Table_1 PRIMARY KEY CLUSTERED (repairId ASC)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON PRIMARY) ON PRIMARYGOSET ANSI_PADDING OFFGO/* Object: Table dbo.Product_info Script Date: 01/1

20、7/2011 16:00:59 */SET ANSI_NULLS ONGOSET QUOTED_IDENTIFIER ONGOSET ANSI_PADDING ONGO記錄數(shù)增長(zhǎng)量表的并發(fā)補(bǔ)充說(shuō)明6.6.表名Login數(shù)據(jù)庫(kù)用戶管理人員主鍵userId 用戶編號(hào)其他排序字段password,userName,tel, birthday,registerTime,type索引字段序號(hào)字段名稱數(shù)據(jù)類型(精度范圍)允許為空 Y/N唯一Y/N區(qū)別度默認(rèn)值約束條件/說(shuō)明1userIdintNY2passwordVarchar(50)NN3userNameSmallDateTimeNN4telVarcha

21、r(50)NN5birthdayVarchar(50)NN6registerTimeSmallDateTimeNN7typeVarchar(50)NNMysql 腳本CREATE TABLE dbo.Login(userId varchar(10) NOT NULL,password varchar(16) NOT NULL,userName varchar(20) NOT NULL,tel varchar(20) NOT NULL,birthday smalldatetime NOT NULL,registerTime smalldatetime NOT NULL,type nvarchar

22、(50) NOT NULL, CONSTRAINT PK_manager_Info PRIMARY KEY CLUSTERED (userId ASC)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON PRIMARY) ON PRIMARYGOSET ANSI_PADDING OFFGO記錄數(shù)增長(zhǎng)量表的并發(fā)補(bǔ)充說(shuō)明5.35.3視圖的設(shè)計(jì)視圖的設(shè)計(jì)根據(jù) XXX 產(chǎn)品的概要設(shè)計(jì)文檔來(lái)確定。視圖的命名按照x

23、x 數(shù)據(jù)庫(kù)設(shè)計(jì)規(guī)范中關(guān)于視圖的命名規(guī)范命名。視圖的設(shè)計(jì)應(yīng)注意以下幾點(diǎn):1 盡量減少列中使用的公式。2 去掉所有不必要的列。3 不要使同一個(gè)文檔屬于多個(gè)分類。4 避免使用表單公式。5.45.4存儲(chǔ)過(guò)程、函數(shù)及觸發(fā)器的設(shè)計(jì)存儲(chǔ)過(guò)程、函數(shù)及觸發(fā)器的設(shè)計(jì)存儲(chǔ)過(guò)程及觸發(fā)器的命名按照xx 數(shù)據(jù)庫(kù)設(shè)計(jì)規(guī)范中關(guān)于存儲(chǔ)過(guò)程及觸發(fā)器的命名規(guī)范命名。存儲(chǔ)過(guò)程:根據(jù)具體得業(yè)務(wù)邏輯確定輸入?yún)?shù)個(gè)數(shù),類型,確定對(duì)哪幾個(gè)表進(jìn)行何種作。 在定義存儲(chǔ)過(guò)程時(shí),要使用其完成單一、相對(duì)集中的任務(wù),不要定義已由其他提供功能的過(guò)程。例如:不要定義強(qiáng)制數(shù)據(jù)完整性的過(guò)程(使用完整性約束) 。函數(shù) :函數(shù)與存儲(chǔ)過(guò)程非常相似,它也是存儲(chǔ)在數(shù)據(jù)庫(kù)

24、中的對(duì)象。但是可以在SQL 命令中使用函數(shù)。就好像建立自己的 substr 函數(shù)一樣觸發(fā)器 :觸發(fā)器是存儲(chǔ)在數(shù)據(jù)庫(kù)中的程序,它在某一特定事件發(fā)生時(shí)執(zhí)行。這些程序可以用 PL/SQL 和 java 語(yǔ)言編寫(xiě),也可以用作 c 語(yǔ)言的調(diào)用,數(shù)據(jù)庫(kù)允許用戶定義這些程序,然后在相關(guān)的表,視圖或者數(shù)據(jù)庫(kù)動(dòng)作執(zhí)行insert,update 或 delete 語(yǔ)句時(shí)執(zhí)行。1.存儲(chǔ)過(guò)程:CREATE PROCEDURE Enter_storage_GetMaxIdASDECLARE TempID intSELECT TempID = max(ESID)+1 FROM Enter_storageIF TempID

25、 IS NULLRETURN 1ELSERETURN TempIDCREATE PROCEDURE Enter_storage_ExistsESID intASDECLARE TempID intSELECT TempID = count(1) FROM Enter_storage WHERE ESID=ESID IF TempID = 0RETURN 0ELSERETURN 1CREATE PROCEDURE Enter_storage_ADDESID int output,product varchar(50),date smalldatetime,num varchar(6),stora

26、geManagerId nvarchar(50) AS INSERT INTO Enter_storage(product,date,num,storageManagerId)VALUES(product,date,num,storageManagerId)SET ESID = IDENTITYCREATE PROCEDURE Enter_storage_UpdateESID int,product varchar(50),date smalldatetime,num varchar(6),storageManagerId nvarchar(50) AS UPDATE Enter_storag

27、e SET product = product,date = date,num = num,storageManagerId = storageManagerIdWHERE ESID=ESID CREATE PROCEDURE Enter_storage_DeleteESID int AS DELETE Enter_storageWHERE ESID=ESID CREATE PROCEDURE Enter_storage_GetModelESID int AS SELECT ESID,product,date,num,storageManagerIdFROM Enter_storageWHER

28、E ESID=ESID CREATE PROCEDURE Enter_storage_GetList AS SELECT ESID,product,date,num,storageManagerIdFROM Enter_storageCREATE PROCEDURE Exit_storage_GetMaxIdASDECLARE TempID intSELECT TempID = max(ExitStorageId)+1 FROM Exit_storageIF TempID IS NULLRETURN 1ELSERETURN TempIDCREATE PROCEDURE Exit_storage

29、_ExistsExitStorageId intASDECLARE TempID intSELECT TempID = count(1) FROM Exit_storage WHERE ExitStorageId=ExitStorageId IF TempID = 0RETURN 0ELSERETURN 1CREATE PROCEDURE Exit_storage_ADDExitStorageId int output,product varchar(50),date smalldatetime,num varchar(6),storageManagerId nvarchar(50) AS I

30、NSERT INTO Exit_storage(product,date,num,storageManagerId)VALUES(product,date,num,storageManagerId)SET ExitStorageId = IDENTITYCREATE PROCEDURE Exit_storage_UpdateExitStorageId int,product varchar(50),date smalldatetime,num varchar(6),storageManagerId nvarchar(50) AS UPDATE Exit_storage SET product

31、= product,date = date,num = num,storageManagerId = storageManagerIdWHERE ExitStorageId=ExitStorageId CREATE PROCEDURE Exit_storage_DeleteExitStorageId int AS DELETE Exit_storageWHERE ExitStorageId=ExitStorageId CREATE PROCEDURE Exit_storage_GetModelExitStorageId int AS SELECT ExitStorageId,product,d

32、ate,num,storageManagerIdFROM Exit_storageWHERE ExitStorageId=ExitStorageId CREATE PROCEDURE Exit_storage_GetList AS SELECT ExitStorageId,product,date,num,storageManagerIdFROM Exit_storageCREATE PROCEDURE Login_ExistsuserId varchar(10)ASDECLARE TempID intSELECT TempID = count(1) FROM Login WHERE user

33、Id=userId IF TempID = 0RETURN 0ELSERETURN 1CREATE PROCEDURE Login_ADDuserId varchar(10),password varchar(16),userName varchar(20),tel varchar(20),birthday smalldatetime,registerTime smalldatetime,type nvarchar(50) AS INSERT INTO Login(userId,password,userName,tel,birthday,registerTime,type)VALUES(us

34、erId,password,userName,tel,birthday,registerTime,type)CREATE PROCEDURE Login_UpdateuserId varchar(10),password varchar(16),userName varchar(20),tel varchar(20),birthday smalldatetime,registerTime smalldatetime,type nvarchar(50) AS UPDATE Login SET password = password,userName = userName,tel = tel,bi

35、rthday = birthday,registerTime = registerTime,type = typeWHERE userId=userId CREATE PROCEDURE Login_DeleteuserId varchar(10) AS DELETE LoginWHERE userId=userId CREATE PROCEDURE Login_GetModeluserId varchar(10) AS SELECT userId,password,userName,tel,birthday,registerTime,typeFROM LoginWHERE userId=us

36、erId CREATE PROCEDURE Login_GetList AS SELECT userId,password,userName,tel,birthday,registerTime,typeFROM LoginCREATE PROCEDURE Product_info_GetMaxIdASDECLARE TempID intSELECT TempID = max(proId)+1 FROM Product_infoIF TempID IS NULLRETURN 1ELSERETURN TempIDCREATE PROCEDURE Product_info_ExistsproId i

37、ntASDECLARE TempID intSELECT TempID = count(1) FROM Product_info WHERE proId=proId IF TempID = 0RETURN 0ELSERETURN 1CREATE PROCEDURE Product_info_ADDproId int output,name varchar(50),price varchar(6),proDate smalldatetime,storage varchar(4) AS INSERT INTO Product_info(name,price,proDate,storage)VALU

38、ES(name,price,proDate,storage)SET proId = IDENTITYCREATE PROCEDURE Product_info_UpdateproId int,name varchar(50),price varchar(6),proDate smalldatetime,storage varchar(4) AS UPDATE Product_info SET name = name,price = price,proDate = proDate,storage = storageWHERE proId=proId CREATE PROCEDURE Produc

39、t_info_DeleteproId int AS DELETE Product_infoWHERE proId=proId CREATE PROCEDURE Product_info_GetModelproId int AS SELECT proId,name,price,proDate,storageFROM Product_infoWHERE proId=proId CREATE PROCEDURE Product_info_GetList AS SELECT proId,name,price,proDate,storageFROM Product_infoCREATE PROCEDUR

40、E Repair_info_GetMaxIdASDECLARE TempID intSELECT TempID = max(repairId)+1 FROM Repair_infoIF TempID IS NULLRETURN 1ELSERETURN TempIDCREATE PROCEDURE Repair_info_ExistsrepairId intASDECLARE TempID intSELECT TempID = count(1) FROM Repair_info WHERE repairId=repairId IF TempID = 0RETURN 0ELSERETURN 1CR

41、EATE PROCEDURE Repair_info_ADDrepairId int output,repairName nchar(10),repairtel nchar(10),product varchar(50),customer varchar(20),date smalldatetime,customertel nchar(10) AS INSERT INTO Repair_info(repairName,repairtel,product,customer,date,customertel)VALUES(repairName,repairtel,product,customer,

42、date,customertel)SET repairId = IDENTITYCREATE PROCEDURE Repair_info_UpdaterepairId int,repairName nchar(10),repairtel nchar(10),product varchar(50),customer varchar(20),date smalldatetime,customertel nchar(10) AS UPDATE Repair_info SET repairName = repairName,repairtel = repairtel,product = product

43、,customer = customer,date = date,customertel = customertelWHERE repairId=repairId CREATE PROCEDURE Repair_info_DeleterepairId int AS DELETE Repair_infoWHERE repairId=repairId CREATE PROCEDURE Repair_info_GetModelrepairId int AS SELECT repairId,repairName,repairtel,product,customer,date,customertelFR

44、OM Repair_infoWHERE repairId=repairId CREATE PROCEDURE Repair_info_GetList AS SELECT repairId,repairName,repairtel,product,customer,date,customertelFROM Repair_infoCREATE PROCEDURE Seller_info_Existsname varchar(50)ASDECLARE TempID intSELECT TempID = count(1) FROM Seller_info WHERE name=name IF Temp

45、ID = 0RETURN 0ELSERETURN 1CREATE PROCEDURE Seller_info_ADDname varchar(50),telephone varchar(20),address varchar(50),product varchar(50),stockNum varchar(6),stockDate smalldatetime,stockPrice varchar(10) AS INSERT INTO Seller_info(name,telephone,address,product,stockNum,stockDate,stockPrice)VALUES(name,telephone,address,product,stockNum,stockDate,stockPrice)CREATE PROCEDURE Seller_info_Updatename varchar(50),telephone varchar(20),address varchar(50),product varchar(50

溫馨提示

  • 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

最新文檔

評(píng)論

0/150

提交評(píng)論