|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
MySQL在业界的流行所带来的另一个好处是,人们总可以很轻松地发现本行业的MySQL学习教程。厂商都希望他们的开发工具和应用程序框架可以与MySQL数据库兼容。access|server|sqlserver|数据
----------------------------------------------
---------------MSSQLServer-----------------
----------------------------------------------
--表申明
SELECTdbo.sysobjects.nameASTableName,
dbo.sysproperties.[value]ASTableDesc
FROMdbo.syspropertiesINNERJOIN
dbo.sysobjectsONdbo.sysproperties.id=dbo.sysobjects.id
WHERE(dbo.sysproperties.smallid=0)
ORDERBYdbo.sysobjects.name
--字段申明
SELECTdbo.sysobjects.nameASTableName,dbo.syscolumns.colid,
dbo.syscolumns.nameASColName,dbo.sysproperties.[value]ASColDesc
FROMdbo.syspropertiesINNERJOIN
dbo.sysobjectsONdbo.sysproperties.id=dbo.sysobjects.idINNERJOIN
dbo.syscolumnsONdbo.sysobjects.id=dbo.syscolumns.idAND
dbo.sysproperties.smallid=dbo.syscolumns.colid
ORDERBYdbo.sysobjects.name,dbo.syscolumns.colid
--主键、外键信息(简化)
select
c_obj.nameasCONSTRAINT_NAME
,t_obj.nameasTABLE_NAME
,col.nameasCOLUMN_NAME
,casecol.colid
whenref.fkey1then1
whenref.fkey2then2
whenref.fkey3then3
whenref.fkey4then4
whenref.fkey5then5
whenref.fkey6then6
whenref.fkey7then7
whenref.fkey8then8
whenref.fkey9then9
whenref.fkey10then10
whenref.fkey11then11
whenref.fkey12then12
whenref.fkey13then13
whenref.fkey14then14
whenref.fkey15then15
whenref.fkey16then16
endasORDINAL_POSITION
from
sysobjectsc_obj
,sysobjectst_obj
,syscolumnscol
,sysreferencesref
where
permissions(t_obj.id)!=0
andc_obj.xtypein(F)
andt_obj.id=c_obj.parent_obj
andt_obj.id=col.id
andcol.colidin
(ref.fkey1,ref.fkey2,ref.fkey3,ref.fkey4,ref.fkey5,ref.fkey6,
ref.fkey7,ref.fkey8,ref.fkey9,ref.fkey10,ref.fkey11,ref.fkey12,
ref.fkey13,ref.fkey14,ref.fkey15,ref.fkey16)
andc_obj.id=ref.constid
union
select
i.nameasCONSTRAINT_NAME
,t_obj.nameasTABLE_NAME
,col.nameasCOLUMN_NAME
,v.numberasORDINAL_POSITION
from
sysobjectsc_obj
,sysobjectst_obj
,syscolumnscol
,master.dbo.spt_valuesv
,sysindexesi
where
permissions(t_obj.id)!=0
andc_obj.xtypein(UQ,PK)
andt_obj.id=c_obj.parent_obj
andt_obj.xtype=U
andt_obj.id=col.id
andcol.name=index_col(t_obj.name,i.indid,v.number)
andt_obj.id=i.id
andc_obj.name=i.name
andv.number>0
andv.number<=i.keycnt
andv.type=P
orderbyCONSTRAINT_NAME,ORDINAL_POSITION
--主键、外键对比(简化)
select
fc_obj.nameasCONSTRAINT_NAME
,i.nameasUNIQUE_CONSTRAINT_NAME
from
sysobjectsfc_obj
,sysreferencesr
,sysindexesi
,sysobjectspc_obj
where
permissions(fc_obj.parent_obj)!=0
andfc_obj.xtype=F
andr.constid=fc_obj.id
andr.rkeyid=i.id
andr.rkeyindid=i.indid
andr.rkeyid=pc_obj.id
----------------------------------------------
-------------------ORACLE-------------------
----------------------------------------------
--表信息
select*fromall_tab_commentst
whereowner=DBO
--列信息
select*fromall_col_commentst
whereowner=DBO
--主键、外键对比
selectOWNER,CONSTRAINT_NAME,CONSTRAINT_TYPE,TABLE_NAME,R_OWNER,R_CONSTRAINT_NAME
fromall_constraints
whereowner=DBOand(Constraint_Type=PorConstraint_Type=R)
--主键、外键信息
select*
fromall_cons_columns
whereowner=DBO
orderbyConstraint_Name,Position
----------------------------------------------
-------------------Access-------------------
----------------------------------------------
//Access中的体系表MSysobjects存储属性的字段是二进制格局,不克不及间接剖析
//能够接纳ADO自带的OpenSchema办法取得相干信息
//useADOInt.pas
//po:TableName
//DBCon:TADOConnection
/ds:TADODataSet
--表信息
DBCon.OpenSchema(siTables,VarArrayOf([Null,Null,Table]),EmptyParam,ds);
--列信息
DBCon.OpenSchema(siColumns,VarArrayOf([Null,Null,po]),EmptyParam,ds);
--主键
DBCon.OpenSchema(siPrimaryKeys,EmptyParam,EmptyParam,ds);
--主键、外键对比
DBCon.OpenSchema(siForeignKeys,EmptyParam,EmptyParam,ds);
与数据库相关的流程的逐渐标准化,使得解决方案提供商能以更便捷的方式提供服务、部署应用程序、规划容量和管理资源。DBaaS模式还有助于减少数据和数据库的冗余度并提升整体服务质量。 |
|