Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB
ÈÈÃűêÇ©£º c c# c++ asp asp.net linux php jsp java vb Python Ruby mysql sql access Sqlite sqlserver delphi javascript Oracle ajax wap mssql html css flash flex dreamweaver xml
 ×îÐÂÎÄÕ : mssql

Ö÷Á÷Êý¾Ý¿âMYSQL/MSSQL/ORACLE²âÊÔÊý¾Ý¿â½Å±¾´úÂë

/******************************************************************************/
/*
Ö÷Á÷Êý¾Ý¿â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²âÊÔÊý¾Ý¿â½Å±¾´úÂë

/******************************************************************************/
/*
Ö÷Á÷Êý¾Ý¿â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²âÊÔÊý¾Ý¿â½Å±¾´úÂë

/******************************************************************************/
/*
Ö÷Á÷Êý¾Ý¿â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 ÐÐÁÐת»»Í¨Óô洢¹ý³Ì£¬ÒѾ­×ª»»µÄMSSQL°æ±¾

ÏÂÃæÊÇ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 ÐÐÁÐת»»Í¨Óô洢¹ý³Ì£¬ÒѾ­×ª»»µÄMSSQL°æ±¾

ÏÂÃæÊÇ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 ......

MSSQL´æ´¢¹ý³ÌʵÀý

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  ......

mssql´æ´¢¹ý³ÌÓï·¨Ïê½â£¨±¸Íü£©


Óï·¨
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 Óï¾ä½«³ýÈ¥Õû¸ö×é¡£Èç¹ ......

mssql sysobjects type˵Ã÷

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 = À©Õ¹´æ´¢¹ý³Ì ......

MSSQL ·Ö²¼Ê½ÊÂÎñ¹ÜÀí

   µ±Êý¾Ý·þÎñÆ÷ºÍWeb·þÎñÆ÷²¿ÊðÔÚ²»Í¬µÄ·þÎñÆ÷ÉÏʱ£¬»áÓõ½·Ö²¼Ê½ÊÂÎñ£¬ÐèÒª¶ÔÁ½¸ö·þÎñÆ÷µÄMSDTC½øÐÐÅäÖá£
    ´ò¿ª“¹ÜÀí¹¤¾ß¨D¨D×é¼þ·þÎñ”£¬ÒÔ´Ë´ò¿ª“×é¼þ·þÎñ¨D¨D¼ÆËã»ú”£¬ÔÚ“ÎҵĵçÄÔ”Éϵã»÷ÓÒ¼ü¡£ÔÚMSDTCÑ¡ÏÖУ¬µã»÷“°²È«ÅäÖÔ°´Å¥¡£
    ÔÚ°²È«ÅäÖô°¿ÚÖÐ×öÈçÏÂÉèÖ㺠
    Ñ¡ÖГÍøÂçDTC·ÃÎÊ”
    ÔÚÊÂÎñ¹ÜÀíͨѶÖÐÑ¡“ÔÊÐíÈëÕ¾”“ÔÊÐí³öÕ¾”“²»ÒªÇó½øÐÐÑé
    Ñ¡ÖГÆôÓÃXAÊÂÎñ(X)”
   Èçͼ£º
×¢ÒâÊÇÊý¾Ý¿â·þÎñÆ÷ºÍWeb·þÎñÆ÷¶¼ÒªÅäÖÃ. ......
×ܼǼÊý:86; ×ÜÒ³Êý:15; ÿҳ6 Ìõ; Ê×Ò³ ÉÏÒ»Ò³ [1] [2] [3] [4] 5 [6] [7] [8] [9] [10]  ÏÂÒ»Ò³ βҳ
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ