^全^ 获取SQL SERVER2000/2005、MySql、Oracle元数据的SQL语句(1)

本文涉及的产品
RDS MySQL Serverless 基础系列,0.5-2RCU 50GB
RDS SQL Server Serverless,2-4RCU 50GB 3个月
推荐场景:
云数据库 RDS MySQL,集群系列 2核4GB
推荐场景:
搭建个人博客
简介:

前言

     前段时间老赵发了一篇关于和谐社区,和谐技术:微软的宠儿们,为什么富人的孩子就不能早当家?引发的争论至今令我诚惶诚恐,说得很在理!!这篇文章本打算放首页的,但是由于是拿来主义,我认为这属于新手的典型特征之一(本来就是新手=_=),故老老实实的放新手区吧。心里比较踏实一点,即使看到的人不多也没关系,自己做个笔记 :)

     有很多朋友都比较关心代码自动生成,理所当然离不开元数据了,但是对于获取元数据的方法不一。由于最近我也在写代码生成,对元数据的获取SQL语句并不齐全,意外的想到了CodeSmith,它也可以根据元数据来生成三层的,于是乎习惯性的去找他的源码了,果然没有失望,我们在SchemaProviders目录下能看到如下文件:

SchemaExplorer.ADOXSchemaProvider.dll

SchemaExplorer.MySQLSchemaProvider.dll

SchemaExplorer.OracleSchemaProvider.dll

SchemaExplorer.SqlSchemaProvider.dll

没有加密!但是SchemaExplorer.SqlSchemaProvider.dll混淆了!用Reflector查看源代码仍然能看到SQL语句,于是乎拷贝出来,替换\t\n,弄了我两个小时才完,今天一搜,原来有源码- - !!超级郁闷!!大伙就别走我的弯路了吧!源码在Samples\Projects\目录下。下面开始Ctrl+C,然后Ctrl+V,贴上来给没有下载CodeSmith的朋友收藏一下吧:)

 

版本

     CodeSmithProfessional 4.1

 

正文

     1.     闲话少说,直接贴SQL2000/2005获取元数据的SQL语句了,大家一看就会明白的。

#region  SQL Templates
        
private   const   string  SQL_GetDatabaseName  =   " SELECT db_name() " ;

        
private   const   string  SQL2005_GetTables  =   @"
          SELECT
              object_name(so.id) AS OBJECT_NAME,
              schema_name(so.uid) AS USER_NAME,
              so.type AS TYPE,
              so.crdate AS DATE_CREATED,
              fg.file_group AS FILE_GROUP,
              so.id as OBJECT_ID
          FROM 
              dbo.sysobjects so
          LEFT JOIN (
              SELECT 
                  s.groupname AS file_group,
                  i.id        AS id
              FROM dbo.sysfilegroups s
              INNER JOIN dbo.sysindexes i
                  ON i.groupid = s.groupid 
              WHERE i.indid < 2                           
          ) AS fg
              ON so.id = fg.id
          WHERE
              so.type = N'U'
              AND permissions(so.id) & 4096 <> 0
              AND ObjectProperty(so.id, N'IsMSShipped') = 0
              AND NOT EXISTS (SELECT * FROM sys.extended_properties WHERE major_id = so.id AND name = 'microsoft_database_tools_support' AND value = 1)
          ORDER BY schema_name(so.uid), object_name(so.id)
" ;

        
private   const   string  SQL2000_GetTables  =   @"
          SELECT
              object_name(so.id) AS OBJECT_NAME,
              user_name(so.uid)  AS USER_NAME,
              so.type            AS TYPE,
              so.crdate          AS DATE_CREATED,
              fg.file_group      AS FILE_GROUP,
              so.id              AS OBJECT_ID
          FROM 
              dbo.sysobjects so
          LEFT JOIN (
                SELECT 
                    s.groupname AS file_group,
                    i.id        AS id
                FROM dbo.sysfilegroups s
                INNER JOIN dbo.sysindexes i
                    ON i.groupid = s.groupid 
                WHERE i.indid < 2                           
              ) AS fg
              ON so.id = fg.id
          WHERE
              so.type = N'U'
              AND permissions(so.id) & 4096 <> 0
              AND ObjectProperty(so.id, N'IsMSShipped') = 0
          ORDER BY user_name(so.uid), object_name(so.id)
" ;

        
private   const   string  SQL_GetTables  =   @"
            SELECT
              object_name(id) AS OBJECT_NAME,
              user_name(uid) AS USER_NAME,
              type AS TYPE,
              crdate AS DATE_CREATED,
              '' AS FILE_GROUP,
              id as OBJECT_ID
            FROM
              sysobjects
            WHERE
              type = N'U'
              AND permissions(id) & 4096 <> 0
              AND ObjectProperty(id, N'IsMSShipped') = 0
            ORDER BY user_name(uid), object_name(id)
" ;

        
private   const   string  SQL2005_GetTableColumns  =   @"
             SELECT
              clmns.[name] AS [Name],
              usrt.[name] AS [DataType],
              ISNULL(baset.[name], N'') AS [SystemType],
              CAST(CASE WHEN baset.[name] IN (N'char', N'varchar', N'binary', N'varbinary', N'nchar', N'nvarchar') THEN clmns.prec ELSE clmns.length END AS int) AS [Length],
              CAST(clmns.xprec AS tinyint) AS [NumericPrecision],
              CAST(clmns.xscale AS int) AS [NumericScale],
              CASE CAST(clmns.isnullable AS bit) WHEN 1 THEN 'YES' ELSE 'NO' END AS [Nullable],
              defaults.text AS [DefaultValue],
              CAST(COLUMNPROPERTY(clmns.id, clmns.[name], N'IsIdentity') AS int) AS [Identity],
              CAST(COLUMNPROPERTY(clmns.id, clmns.[name], N'IsRowGuidCol') AS int) AS IsRowGuid,
              CAST(COLUMNPROPERTY(clmns.id, clmns.[name], N'IsComputed') AS int) AS IsComputed,
              CAST(COLUMNPROPERTY(clmns.id, clmns.[name], N'IsDeterministic') AS int) AS IsDeterministic,
              CAST(CASE COLUMNPROPERTY(clmns.id, clmns.[name], N'IsIdentity') WHEN 1 THEN IDENT_SEED(QUOTENAME(SCHEMA_NAME(tbl.uid)) + '.' + QUOTENAME(tbl.[name])) ELSE 0 END AS nvarchar(40)) AS [IdentitySeed],
              CAST(CASE COLUMNPROPERTY(clmns.id, clmns.[name], N'IsIdentity') WHEN 1 THEN IDENT_INCR(QUOTENAME(SCHEMA_NAME(tbl.uid)) + '.' + QUOTENAME(tbl.[name])) ELSE 0 END AS nvarchar(40)) AS [IdentityIncrement],
              cdef.[text] AS ComputedDefinition,
              clmns.[collation] AS Collation,
              CAST(clmns.colid AS int) AS ObjectId
            FROM
              dbo.sysobjects AS tbl
              INNER JOIN dbo.syscolumns AS clmns ON clmns.id=tbl.id
              LEFT JOIN dbo.systypes AS usrt ON usrt.xusertype = clmns.xusertype
              LEFT JOIN dbo.sysusers AS sclmns ON sclmns.uid = usrt.uid
              LEFT JOIN dbo.systypes AS baset ON baset.xusertype = clmns.xtype and baset.xusertype = baset.xtype
              LEFT JOIN dbo.syscomments AS defaults ON defaults.id = clmns.cdefault
              LEFT JOIN dbo.syscomments AS cdef ON cdef.id = clmns.id AND cdef.number = clmns.colid
            WHERE
              (tbl.[type] = 'U' OR tbl.[type] = 'S')
              AND SCHEMA_NAME(tbl.uid) = @SchemaName
              AND tbl.[name] = @TableName
            ORDER BY
              clmns.colorder
" ;

        
private   const   string  SQL2000_GetTableColumns  =   @"
              SELECT
                clmns.[name] AS [Name],
                usrt.[name] AS [DataType],
                ISNULL(baset.[name], N'') AS [SystemType],
                CAST(CASE WHEN baset.[name] IN (N'char', N'varchar', N'binary', N'varbinary', N'nchar', N'nvarchar') THEN clmns.prec ELSE clmns.length END AS INT) AS [Length],
                CAST(clmns.xprec AS TINYINT) AS [NumericPrecision],
                CAST(clmns.xscale AS INT) AS [NumericScale],
                CASE CAST(clmns.isnullable AS BIT) WHEN 1 THEN 'YES' ELSE 'NO' END AS [Nullable],
                defaults.text AS [DefaultValue],
                CAST(COLUMNPROPERTY(clmns.id, clmns.[name], N'IsIdentity') AS INT) AS [Identity],
                CAST(COLUMNPROPERTY(clmns.id, clmns.[name], N'IsRowGuidCol') AS INT) AS IsRowGuid,
                CAST(COLUMNPROPERTY(clmns.id, clmns.[name], N'IsComputed') AS INT) AS IsComputed,
                CAST(COLUMNPROPERTY(clmns.id, clmns.[name], N'IsDeterministic') AS INT) AS IsDeterministic,
                CAST(CASE COLUMNPROPERTY(clmns.id, clmns.[name], N'IsIdentity') WHEN 1 THEN IDENT_SEED(QUOTENAME(stbl.[name]) + '.' + QUOTENAME(tbl.[name])) ELSE 0 END AS NVARCHAR(40)) AS [IdentitySeed],
                CAST(CASE COLUMNPROPERTY(clmns.id, clmns.[name], N'IsIdentity') WHEN 1 THEN IDENT_INCR(QUOTENAME(stbl.[name]) + '.' + QUOTENAME(tbl.[name])) ELSE 0 END AS NVARCHAR(40)) AS [IdentityIncrement],
                cdef.[text] AS ComputedDefinition,
                clmns.[collation] AS Collation,
                CAST(clmns.colid AS int) AS ObjectId
              FROM
                dbo.sysobjects AS tbl
                INNER JOIN dbo.sysusers AS stbl ON stbl.[uid] = tbl.[uid]
                INNER JOIN dbo.syscolumns AS clmns ON clmns.id=tbl.id
                LEFT JOIN dbo.systypes AS usrt ON usrt.xusertype = clmns.xusertype
                LEFT JOIN dbo.sysusers AS sclmns ON sclmns.uid = usrt.uid
                LEFT JOIN dbo.systypes AS baset ON baset.xusertype = clmns.xtype and baset.xusertype = baset.xtype
                LEFT JOIN dbo.syscomments AS defaults ON defaults.id = clmns.cdefault
                LEFT JOIN dbo.syscomments AS cdef ON cdef.id = clmns.id AND cdef.number = clmns.colid
              WHERE
                (tbl.[type] = 'U' OR tbl.[type] = 'S') 
                AND stbl.[name] = @SchemaName
                AND tbl.[name] = @TableName
              ORDER BY
                  clmns.colorder
" ;

        
private   const   string  SQL_GetTableColumns  =   @"
                  SELECT
                      cols.COLUMN_NAME,
                      CASE
                          WHEN cols.DOMAIN_NAME IS NOT NULL THEN cols.DOMAIN_NAME
                          ELSE cols.DATA_TYPE
                      END
                      AS DATA_TYPE,
                      cols.DATA_TYPE AS UNDERLYING_TYPE,
                      CAST(cols.CHARACTER_MAXIMUM_LENGTH AS int),
                      cols.NUMERIC_PRECISION,
                      cols.NUMERIC_SCALE,
                      cols.IS_NULLABLE,
                      cols.COLUMN_DEFAULT,
                      COLUMNPROPERTY(OBJECT_ID(N'[' + @DatabaseName + N'].[' + @OwnerName + N'].[' + @TableName + N']'),cols.COLUMN_NAME,'IsIdentity') AS IS_IDENTITY,
                      COLUMNPROPERTY(OBJECT_ID(N'[' + @DatabaseName + N'].[' + @OwnerName + N'].[' + @TableName + N']'),cols.COLUMN_NAME,'IsRowGuidCol') AS IS_ROW_GUID_COL,
                      COLUMNPROPERTY(OBJECT_ID(N'[' + @DatabaseName + N'].[' + @OwnerName + N'].[' + @TableName + N']'),cols.COLUMN_NAME,'IsComputed') AS IS_COMPUTED,
                      COLUMNPROPERTY(OBJECT_ID(N'[' + @DatabaseName + N'].[' + @OwnerName + N'].[' + @TableName + N']'),cols.COLUMN_NAME,'IsDeterministic') AS IS_DETERMINISTIC,
                      CASE WHEN (COLUMNPROPERTY(OBJECT_ID(N'[' + @DatabaseName + N'].[' + @OwnerName + N'].[' + @TableName + N']'), cols.COLUMN_NAME, N'IsIdentity') <> 0) then CONVERT(nvarchar(40), ident_seed(N'[' + @DatabaseName + N'].[' + @OwnerName + N'].[' + @TableName + N']')) else null end AS IDENTITY_SEED,
                      CASE WHEN (COLUMNPROPERTY(OBJECT_ID(N'[' + @DatabaseName + N'].[' + @OwnerName + N'].[' + @TableName + N']'), cols.COLUMN_NAME, N'IsIdentity') <> 0) then CONVERT(nvarchar(40), ident_incr(N'[' + @DatabaseName + N'].[' + @OwnerName + N'].[' + @TableName + N']')) else null end AS IDENTITY_INCREMENT,
                    NULL AS COMPUTED_DEFINITION,
                    NULL AS [collation],
                    CAST(0 AS int) AS ObjectId
                  FROM
                      INFORMATION_SCHEMA.COLUMNS cols
                  WHERE
                      cols.TABLE_CATALOG = @DatabaseName
                      AND cols.TABLE_SCHEMA = @OwnerName
                      AND cols.TABLE_NAME = @TableName
                  ORDER BY
                      cols.ORDINAL_POSITION
" ;

        
private   const   string  SQL2005_GetViews  =   @"
                  SELECT
                      object_name(id) AS OBJECT_NAME,
                      schema_name(uid) AS USER_NAME,
                      type AS TYPE,
                      crdate AS DATE_CREATED,
                      id as OBJECT_ID
                  FROM
                      sysobjects
                  WHERE
                      type = N'V'
                      AND permissions(id) & 4096 <> 0
                      AND ObjectProperty(id, N'IsMSShipped') = 0
                      AND NOT EXISTS (SELECT * FROM sys.extended_properties WHERE major_id = id AND name = 'microsoft_database_tools_support' AND value = 1)
                  ORDER BY object_name(id)
" ;

        
private   const   string  SQL_GetViews  =   @"
                  SELECT
                      object_name(id) AS OBJECT_NAME,
                      user_name(uid) AS USER_NAME,
                      type AS TYPE,
                      crdate AS DATE_CREATED,
                      id as OBJECT_ID
                  FROM
                      sysobjects
                  WHERE
                      type = N'V'
                      AND permissions(id) & 4096 <> 0
                      AND ObjectProperty(id, N'IsMSShipped') = 0
          ORDER BY object_name(id)
" ;

        
private   const   string  SQL2000_GetViewColumns  =   @"
                  SELECT
                      cols.COLUMN_NAME,
                      CASE
                          WHEN cols.DOMAIN_NAME IS NOT NULL THEN cols.DOMAIN_NAME COLLATE Latin1_General_BIN
                          ELSE cols.DATA_TYPE
                      END
                      AS DATA_TYPE,
                      cols.DATA_TYPE AS UNDERLYING_TYPE,
                      CAST(cols.CHARACTER_MAXIMUM_LENGTH AS int),
                      cols.NUMERIC_PRECISION,
                      cols.NUMERIC_SCALE,
                      cols.IS_NULLABLE,
                      COLUMNPROPERTY(OBJECT_ID(N'[' + @DatabaseName + N'].[' + @OwnerName + N'].[' + @ViewName + N']'),cols.COLUMN_NAME,'IsComputed') AS IS_COMPUTED,
                      COLUMNPROPERTY(OBJECT_ID(N'[' + @DatabaseName + N'].[' + @OwnerName + N'].[' + @ViewName + N']'),cols.COLUMN_NAME,'IsDeterministic') AS IS_DETERMINISTIC
                  FROM
                      INFORMATION_SCHEMA.COLUMNS cols
                  WHERE
                      cols.TABLE_CATALOG = @DatabaseName
                      AND cols.TABLE_SCHEMA = @OwnerName
                      AND cols.TABLE_NAME = @ViewName
                  ORDER BY
                      cols.ORDINAL_POSITION
" ;

        
private   const   string  SQL_GetViewColumns  =   @"
                  SELECT
                      cols.COLUMN_NAME,
                      CASE
                          WHEN cols.DOMAIN_NAME IS NOT NULL THEN cols.DOMAIN_NAME
                          ELSE cols.DATA_TYPE
                      END
                      AS DATA_TYPE,
                      cols.DATA_TYPE AS UNDERLYING_TYPE,
                      CAST(cols.CHARACTER_MAXIMUM_LENGTH AS int),
                      cols.NUMERIC_PRECISION,
                      cols.NUMERIC_SCALE,
                      cols.IS_NULLABLE,
                      COLUMNPROPERTY(OBJECT_ID(N'[' + @DatabaseName + N'].[' + @OwnerName + N'].[' + @ViewName + N']'),cols.COLUMN_NAME,'IsComputed') AS IS_COMPUTED,
                      COLUMNPROPERTY(OBJECT_ID(N'[' + @DatabaseName + N'].[' + @OwnerName + N'].[' + @ViewName + N']'),cols.COLUMN_NAME,'IsDeterministic') AS IS_DETERMINISTIC
                  FROM
                      INFORMATION_SCHEMA.COLUMNS cols
                  WHERE
                      cols.TABLE_CATALOG = @DatabaseName
                      AND cols.TABLE_SCHEMA = @OwnerName
                      AND cols.TABLE_NAME = @ViewName
                  ORDER BY
                      cols.ORDINAL_POSITION
" ;

        
private   const   string  SQL_GetTablePrimaryKey  =   " EXEC sp_MStablekeys @tablename " ;

        
private   const   string  SQL_GetTableIndexes  =   @"
        SELECT 
          i.name, 
          i.status, 
          i.indid, 
          i.OrigFillFactor,
          IndCol1  = INDEX_COL(@tablename, i.indid, 1),
          IndCol2  = INDEX_COL(@tablename, i.indid, 2),
          IndCol3  = INDEX_COL(@tablename, i.indid, 3),
          IndCol4  = INDEX_COL(@tablename, i.indid, 4),
          IndCol5  = INDEX_COL(@tablename, i.indid, 5),
          IndCol6  = INDEX_COL(@tablename, i.indid, 6),
          IndCol7  = INDEX_COL(@tablename, i.indid, 7),
          IndCol8  = INDEX_COL(@tablename, i.indid, 8),
          IndCol9  = INDEX_COL(@tablename, i.indid, 9),
          IndCol10 = INDEX_COL(@tablename, i.indid, 10),
          IndCol11 = INDEX_COL(@tablename, i.indid, 11),
          IndCol12 = INDEX_COL(@tablename, i.indid, 12),
          IndCol13 = INDEX_COL(@tablename, i.indid, 13),
          IndCol14 = INDEX_COL(@tablename, i.indid, 14),
          IndCol15 = INDEX_COL(@tablename, i.indid, 15),
          IndCol16 = INDEX_COL(@tablename, i.indid, 16),    
          IsDescCol1  = INDEXKEY_PROPERTY(OBJECT_ID(@tablename), i.indid, 1,  N'isdescending'),
          IsDescCol2  = INDEXKEY_PROPERTY(OBJECT_ID(@tablename), i.indid, 2,  N'isdescending'),
          IsDescCol3  = INDEXKEY_PROPERTY(OBJECT_ID(@tablename), i.indid, 3,  N'isdescending'),
          IsDescCol4  = INDEXKEY_PROPERTY(OBJECT_ID(@tablename), i.indid, 4,  N'isdescending'),
          IsDescCol5  = INDEXKEY_PROPERTY(OBJECT_ID(@tablename), i.indid, 5,  N'isdescending'),
          IsDescCol6  = INDEXKEY_PROPERTY(OBJECT_ID(@tablename), i.indid, 6,  N'isdescending'),
          IsDescCol7  = INDEXKEY_PROPERTY(OBJECT_ID(@tablename), i.indid, 7,  N'isdescending'),
          IsDescCol8  = INDEXKEY_PROPERTY(OBJECT_ID(@tablename), i.indid, 8,  N'isdescending'),
          IsDescCol9  = INDEXKEY_PROPERTY(OBJECT_ID(@tablename), i.indid, 9,  N'isdescending'),
          IsDescCol10 = INDEXKEY_PROPERTY(OBJECT_ID(@tablename), i.indid, 10, N'isdescending'),
          IsDescCol11 = INDEXKEY_PROPERTY(OBJECT_ID(@tablename), i.indid, 11, N'isdescending'),
          IsDescCol12 = INDEXKEY_PROPERTY(OBJECT_ID(@tablename), i.indid, 12, N'isdescending'),
          IsDescCol13 = INDEXKEY_PROPERTY(OBJECT_ID(@tablename), i.indid, 13, N'isdescending'),
          IsDescCol14 = INDEXKEY_PROPERTY(OBJECT_ID(@tablename), i.indid, 14, N'isdescending'),
          IsDescCol15 = INDEXKEY_PROPERTY(OBJECT_ID(@tablename), i.indid, 15, N'isdescending'),
          IsDescCol16 = INDEXKEY_PROPERTY(OBJECT_ID(@tablename), i.indid, 16, N'isdescending'),    
          IsCompCol1  = COLUMNPROPERTY(OBJECT_ID(@tablename), INDEX_COL(@tablename, i.indid, 1),  N'IsComputed'),
          IsCompCol2  = COLUMNPROPERTY(OBJECT_ID(@tablename), INDEX_COL(@tablename, i.indid, 2),  N'IsComputed'),
          IsCompCol3  = COLUMNPROPERTY(OBJECT_ID(@tablename), INDEX_COL(@tablename, i.indid, 3),  N'IsComputed'),
          IsCompCol4  = COLUMNPROPERTY(OBJECT_ID(@tablename), INDEX_COL(@tablename, i.indid, 4),  N'IsComputed'),
          IsCompCol5  = COLUMNPROPERTY(OBJECT_ID(@tablename), INDEX_COL(@tablename, i.indid, 5),  N'IsComputed'),
          IsCompCol6  = COLUMNPROPERTY(OBJECT_ID(@tablename), INDEX_COL(@tablename, i.indid, 6),  N'IsComputed'),
          IsCompCol7  = COLUMNPROPERTY(OBJECT_ID(@tablename), INDEX_COL(@tablename, i.indid, 7),  N'IsComputed'),
          IsCompCol8  = COLUMNPROPERTY(OBJECT_ID(@tablename), INDEX_COL(@tablename, i.indid, 8),  N'IsComputed'),
          IsCompCol9  = COLUMNPROPERTY(OBJECT_ID(@tablename), INDEX_COL(@tablename, i.indid, 9),  N'IsComputed'),
          IsCompCol10 = COLUMNPROPERTY(OBJECT_ID(@tablename), INDEX_COL(@tablename, i.indid, 10), N'IsComputed'),
          IsCompCol11 = COLUMNPROPERTY(OBJECT_ID(@tablename), INDEX_COL(@tablename, i.indid, 11), N'IsComputed'),
          IsCompCol12 = COLUMNPROPERTY(OBJECT_ID(@tablename), INDEX_COL(@tablename, i.indid, 12), N'IsComputed'),
          IsCompCol13 = COLUMNPROPERTY(OBJECT_ID(@tablename), INDEX_COL(@tablename, i.indid, 13), N'IsComputed'),
          IsCompCol14 = COLUMNPROPERTY(OBJECT_ID(@tablename), INDEX_COL(@tablename, i.indid, 14), N'IsComputed'),
          IsCompCol15 = COLUMNPROPERTY(OBJECT_ID(@tablename), INDEX_COL(@tablename, i.indid, 15), N'IsComputed'),
          IsCompCol16 = COLUMNPROPERTY(OBJECT_ID(@tablename), INDEX_COL(@tablename, i.indid, 16), N'IsComputed'),    
          SegName          = s.groupname,
          IsFullTextKey    = INDEXPROPERTY(OBJECT_ID(@tablename), i.name, N'IsFulltextKey'),
          IsTable          = OBJECTPROPERTY(OBJECT_ID(@tablename), N'IsTable'),
          IsStatistics     = INDEXPROPERTY(OBJECT_ID(@tablename), i.name, N'IsStatistics'),
          IsAutoStatistics = INDEXPROPERTY(OBJECT_ID(@tablename), i.name, N'IsAutoStatistics'),
          IsHypothetical   = INDEXPROPERTY(OBJECT_ID(@tablename), i.name, N'IsHypothetical'),
          IsConstraint     = CASE WHEN c.constid IS NOT NULL THEN 1 ELSE 0 END    

本文转自over140 51CTO博客,原文链接:http://blog.51cto.com/over140/586712,如需转载请自行联系原作者
相关实践学习
如何在云端创建MySQL数据库
开始实验后,系统会自动创建一台自建MySQL的 源数据库 ECS 实例和一台 目标数据库 RDS。
全面了解阿里云能为你做什么
阿里云在全球各地部署高效节能的绿色数据中心,利用清洁计算为万物互联的新世界提供源源不断的能源动力,目前开服的区域包括中国(华北、华东、华南、香港)、新加坡、美国(美东、美西)、欧洲、中东、澳大利亚、日本。目前阿里云的产品涵盖弹性计算、数据库、存储与CDN、分析与搜索、云通信、网络、管理与监控、应用服务、互联网中间件、移动服务、视频服务等。通过本课程,来了解阿里云能够为你的业务带来哪些帮助 &nbsp; &nbsp; 相关的阿里云产品:云服务器ECS 云服务器 ECS(Elastic Compute Service)是一种弹性可伸缩的计算服务,助您降低 IT 成本,提升运维效率,使您更专注于核心业务创新。产品详情: https://www.aliyun.com/product/ecs
相关文章
|
2月前
|
SQL 运维 关系型数据库
MySQL 运维 SQL 备忘
MySQL 运维 SQL 备忘录
47 1
|
29天前
|
SQL 关系型数据库 MySQL
MySql5.6版本开启慢SQL功能-本次采用永久生效方式
MySql5.6版本开启慢SQL功能-本次采用永久生效方式
38 0
|
29天前
|
SQL 关系型数据库 MySQL
mysql编写sql脚本:要求表没有主键,但是想查询没有相同值的时候才进行插入
mysql编写sql脚本:要求表没有主键,但是想查询没有相同值的时候才进行插入
31 0
|
2月前
|
SQL 存储 关系型数据库
mysql 数据库空间统计sql
mysql 数据库空间统计sql
47 0
|
3月前
|
关系型数据库 MySQL 网络安全
5-10Can't connect to MySQL server on 'sh-cynosl-grp-fcs50xoa.sql.tencentcdb.com' (110)")
5-10Can't connect to MySQL server on 'sh-cynosl-grp-fcs50xoa.sql.tencentcdb.com' (110)")
|
5月前
|
SQL 存储 监控
SQL Server的并行实施如何优化?
【7月更文挑战第23天】SQL Server的并行实施如何优化?
116 13
|
5月前
|
SQL
解锁 SQL Server 2022的时间序列数据功能
【7月更文挑战第14天】要解锁SQL Server 2022的时间序列数据功能,可使用`generate_series`函数生成整数序列,例如:`SELECT value FROM generate_series(1, 10)。此外,`date_bucket`函数能按指定间隔(如周)对日期时间值分组,这些工具结合窗口函数和其他时间日期函数,能高效处理和分析时间序列数据。更多信息请参考官方文档和技术资料。
|
5月前
|
SQL 存储 网络安全
关系数据库SQLserver 安装 SQL Server
【7月更文挑战第26天】
63 6
|
5月前
|
存储 SQL C++
对比 SQL Server中的VARCHAR(max) 与VARCHAR(n) 数据类型
【7月更文挑战7天】SQL Server 中的 VARCHAR(max) vs VARCHAR(n): - VARCHAR(n) 存储最多 n 个字符(1-8000),适合短文本。 - VARCHAR(max) 可存储约 21 亿个字符,适合大量文本。 - VARCHAR(n) 在处理小数据时性能更好,空间固定。 - VARCHAR(max) 对于大文本更合适,但可能影响性能。 - 选择取决于数据长度预期和业务需求。
403 1
|
4月前
|
SQL 安全 Java
驱动程序无法通过使用安全套接字层(SSL)加密与 SQL Server 建立安全连接。错误:“The server selected protocol version TLS10 is not accepted by client
驱动程序无法通过使用安全套接字层(SSL)加密与 SQL Server 建立安全连接。错误:“The server selected protocol version TLS10 is not accepted by client
505 0

推荐镜像

更多