/******************************************************************************/
/*
Ö÷Á÷Êý¾Ý¿âMYSQL/MSSQL/ORACLE²âÊÔÊý¾Ý¿â½Å±¾´úÂë
½Å±¾ÈÎÎñ:½¨Á¢4¸ö±í,Ìí¼ÓÖ÷¼ü,Íâ¼ü£¬²åÈëÊý¾Ý,½¨Á¢ÊÓͼ
ÔËÐл·¾³1:microsoft sqlserver 2000 ²éѯ·ÖÎöÆ÷
ÔËÐл·¾³2:mysql5.0 phpMyAdminÍøÒ³½çÃæ
ÔËÐл·¾³3:oracle 9i SQL*PLUSÃüÁîÐнçÃæ
author£ºchinayaosir
blog: http://blog.csdn.net/chinayaosir/
QQ: 44633197
ÉùÃ÷£ºÑϽûÆäËüÍøÕ¾²»¾¹ý×÷ÕßchinayaosirͬÒâÈÎÒâתÔØ
*/
/******************************************************************************/
/*script test ok with microsoft sqlserver 2000 ²éѯ·ÖÎöÆ÷ */
/******************************************************************************/
/*DB:MSSQL2000 SCRIPT*/
/*0.drop table list*/
drop table Employee;
drop table Department;
drop table Post;
drop table Account;
/*********************************************************/
/*DB ......
/******************************************************************************/
/*
Ö÷Á÷Êý¾Ý¿âMYSQL/MSSQL/ORACLE²âÊÔÊý¾Ý¿â½Å±¾´úÂë
½Å±¾ÈÎÎñ:½¨Á¢4¸ö±í,Ìí¼ÓÖ÷¼ü,Íâ¼ü£¬²åÈëÊý¾Ý,½¨Á¢ÊÓͼ
ÔËÐл·¾³1:microsoft sqlserver 2000 ²éѯ·ÖÎöÆ÷
ÔËÐл·¾³2:mysql5.0 phpMyAdminÍøÒ³½çÃæ
ÔËÐл·¾³3:oracle 9i SQL*PLUSÃüÁîÐнçÃæ
author£ºchinayaosir
blog: http://blog.csdn.net/chinayaosir/
QQ: 44633197
ÉùÃ÷£ºÑϽûÆäËüÍøÕ¾²»¾¹ý×÷ÕßchinayaosirͬÒâÈÎÒâתÔØ
*/
/******************************************************************************/
/*script test ok with microsoft sqlserver 2000 ²éѯ·ÖÎöÆ÷ */
/******************************************************************************/
/*DB:MSSQL2000 SCRIPT*/
/*0.drop table list*/
drop table Employee;
drop table Department;
drop table Post;
drop table Account;
/*********************************************************/
/*DB ......
/******************************************************************************/
/*
Ö÷Á÷Êý¾Ý¿âMYSQL/MSSQL/ORACLE²âÊÔÊý¾Ý¿â½Å±¾´úÂë
½Å±¾ÈÎÎñ:½¨Á¢4¸ö±í,Ìí¼ÓÖ÷¼ü,Íâ¼ü£¬²åÈëÊý¾Ý,½¨Á¢ÊÓͼ
ÔËÐл·¾³1:microsoft sqlserver 2000 ²éѯ·ÖÎöÆ÷
ÔËÐл·¾³2:mysql5.0 phpMyAdminÍøÒ³½çÃæ
ÔËÐл·¾³3:oracle 9i SQL*PLUSÃüÁîÐнçÃæ
author£ºchinayaosir
blog: http://blog.csdn.net/chinayaosir/
QQ: 44633197
ÉùÃ÷£ºÑϽûÆäËüÍøÕ¾²»¾¹ý×÷ÕßchinayaosirͬÒâÈÎÒâתÔØ
*/
/******************************************************************************/
/*script test ok with microsoft sqlserver 2000 ²éѯ·ÖÎöÆ÷ */
/******************************************************************************/
/*DB:MSSQL2000 SCRIPT*/
/*0.drop table list*/
drop table Employee;
drop table Department;
drop table Post;
drop table Account;
/*********************************************************/
/*DB ......
ÏÂÃæÊÇORACLEÐÐÁÐת»»Í¨Óô洢¹ý³Ì£º
1¡¢
Function Fun_Split_Str(p_Str Varchar2, p_Division Varchar2, p_Seq Int)
Return Varchar2 Is
v_First Int;
v_Last Int;
Begin
If p_Seq < 1 Then
Return Null;
End If;
If p_Seq = 1 Then
If Instr(p_Str, p_Division, 1, p_Seq) = 0 Then
Return p_Str;
Else
Return Substr(p_Str, 1, Instr(p_Str, p_Division, 1) - 1);
End If;
Else
v_First := Instr(p_Str, p_Division, 1, p_Seq - 1);
v_Last := Instr(p_Str, p_Division, 1, p_Seq);
If (v_Last = 0) Then
If (v_F ......
ÏÂÃæÊÇORACLEÐÐÁÐת»»Í¨Óô洢¹ý³Ì£º
1¡¢
Function Fun_Split_Str(p_Str Varchar2, p_Division Varchar2, p_Seq Int)
Return Varchar2 Is
v_First Int;
v_Last Int;
Begin
If p_Seq < 1 Then
Return Null;
End If;
If p_Seq = 1 Then
If Instr(p_Str, p_Division, 1, p_Seq) = 0 Then
Return p_Str;
Else
Return Substr(p_Str, 1, Instr(p_Str, p_Division, 1) - 1);
End If;
Else
v_First := Instr(p_Str, p_Division, 1, p_Seq - 1);
v_Last := Instr(p_Str, p_Division, 1, p_Seq);
If (v_Last = 0) Then
If (v_F ......
Create proc RegisterUser
(
@usrName varchar(30)
,@usrPasswd varchar(30)
,@age int
,@PhoneNum varchar(20)
,@Address varchar(50)
)
as
begin
--ÏÔʾ¶¨Òå²¢¿ªÊ¼Ò»¸öÊÂÎñ
begin tran
insert into user
(
userName
,userPasswd
)
values
(
@usrName
,@usrPasswd
)
if @@error<>0
begin
--²Ù×÷ʧ°Ü£¬ÔòÊÂÎñ»Ø¹ö
rollback tran
--·µ»Ø´æ´¢¹ý³Ì£¬²¢ÉèÖ÷µ»ØÂëΪÊÂÎñ²Ù×÷ʧ°Ü
return £1
end
--²åÈëÓÃÐÅÏ¢
insert into userdoc(
userName
,age
,sex
,PhoneNumber
,Address)
values(
@Usrname
,@age
,@PhoneNum
,@Address)
if @@error<>0
begin
--²Ù×÷ʧ°Ü£¬ÔòÊÂÎñ»Ø¹ö
rollback tran
return £1
end
--Èç¹û²Ù×÷Ö´ÐÐÕýÈ·£¬ÔòÌá½»ÊÂÎñ
commit tran
return 0
end ......
Óï·¨
CREATE PROC[ EDURE ] [ owner. ] procedure_name [ ; number ]
[ { @parameter data_type }
[ VARYING ] [ = default ] [ OUTPUT ]
] [ ,...n ]
[ WITH
{ RECOMPILE | ENCRYPTION | RECOMPILE , ENCRYPTION } ]
[ FOR REPLICATION ]
AS sql_statement [ ...n ]
²ÎÊý
owner
ÓµÓд洢¹ý³ÌµÄÓû§ ID µÄÃû³Æ¡£owner ±ØÐëÊǵ±Ç°Óû§µÄÃû³Æ»òµ±Ç°Óû§ËùÊôµÄ½ÇÉ«µÄÃû³Æ¡£
procedure_name
д洢¹ý³ÌµÄÃû³Æ¡£¹ý³ÌÃû±ØÐë·ûºÏ±êʶ·û¹æÔò£¬ÇÒ¶ÔÓÚÊý¾Ý¿â¼°ÆäËùÓÐÕß±ØÐëΨһ¡£
;number
ÊÇ¿ÉÑ¡µÄÕûÊý£¬ÓÃÀ´¶ÔͬÃûµÄ¹ý³Ì·Ö×飬ÒÔ±ãÓÃÒ»Ìõ DROP PROCEDURE Óï¾ä¼´¿É½«Í¬×éµÄ¹ý³ÌÒ»Æð³ýÈ¥¡£ÀýÈ磬ÃûΪ orders µÄÓ¦ÓóÌÐòʹÓõĹý³Ì¿ÉÒÔÃüÃûΪorderproc;1¡¢orderproc;2 µÈ¡£DROP PROCEDURE orderproc Óï¾ä½«³ýÈ¥Õû¸ö×é¡£Èç¹ ......
xtype ´ú±íÀàÐÍ
C = CHECK Ô¼Êø
D = ĬÈÏÖµ»ò DEFAULT Ô¼Êø
F = FOREIGN KEY Ô¼Êø
L = ÈÕÖ¾
FN = ±êÁ¿º¯Êý
IF = ÄÚǶ±íº¯Êý
P = ´æ´¢¹ý³Ì
PK = PRIMARY KEY Ô¼Êø£¨ÀàÐÍÊÇ K£©
RF = ¸´ÖÆɸѡ´æ´¢¹ý³Ì
S = ϵͳ±í
TF = ±íº¯Êý
TR = ´¥·¢Æ÷
U = Óû§±í
UQ = UNIQUE Ô¼Êø£¨ÀàÐÍÊÇ K£©
V = ÊÓͼ
X = À©Õ¹´æ´¢¹ý³Ì ......
µ±Êý¾Ý·þÎñÆ÷ºÍWeb·þÎñÆ÷²¿ÊðÔÚ²»Í¬µÄ·þÎñÆ÷ÉÏʱ£¬»áÓõ½·Ö²¼Ê½ÊÂÎñ£¬ÐèÒª¶ÔÁ½¸ö·þÎñÆ÷µÄMSDTC½øÐÐÅäÖá£
´ò¿ª“¹ÜÀí¹¤¾ß¨D¨D×é¼þ·þÎñ”£¬ÒÔ´Ë´ò¿ª“×é¼þ·þÎñ¨D¨D¼ÆËã»ú”£¬ÔÚ“ÎҵĵçÄÔ”Éϵã»÷ÓÒ¼ü¡£ÔÚMSDTCÑ¡ÏÖУ¬µã»÷“°²È«ÅäÖÔ°´Å¥¡£
ÔÚ°²È«ÅäÖô°¿ÚÖÐ×öÈçÏÂÉèÖãº
Ñ¡ÖГÍøÂçDTC·ÃÎÊ”
ÔÚÊÂÎñ¹ÜÀíͨѶÖÐÑ¡“ÔÊÐíÈëÕ¾”“ÔÊÐí³öÕ¾”“²»ÒªÇó½øÐÐÑé
Ñ¡ÖГÆôÓÃXAÊÂÎñ(X)”
Èçͼ£º
×¢ÒâÊÇÊý¾Ý¿â·þÎñÆ÷ºÍWeb·þÎñÆ÷¶¼ÒªÅäÖÃ. ......