Sql Server 生成数据字典
use Dbname
go
select
[表名]=c.Name,
[表说明]=isnull(f.[value],''),
[列名]=a.Name,
[列序號]=a.Column_id,
[标识]=case when is_identity=1 then '√' else '' end,
[主鍵]=case when exists(select 1 from sys.objects x join sys.indexes y on x.Type=N'PK' and x.Name=y.Name
join sysindexkeys z on z.ID=a.Object_id and z.indid=y.index_id and z.Colid=a.Column_id)
then '√' else '' end,
[类型]=b.Name,
[字节数]=case when a.[max_length]=-1 and b.Name!='xml' then 'max/2G'
when b.Name='xml' then '2^31-1字節/2G'
else rtrim(a.[max_length]) end,
[长度]=case when ColumnProperty(a.object_id,a.Name,'Precision')=-1 then '2^31-1'
else rtrim(ColumnProperty(a.object_id,a.Name,'Precision')) end,
[小数]=isnull(ColumnProperty(a.object_id,a.Name,'Scale'),0),
[是否为空]=case when a.is_nullable=1 then '√' else '' end,
[列说明]=isnull(e.[value],''),
[默认值]=isnull(d.text,'')
from
sys.columns a &
相关文档:
使用SQL Server导入/导出Excel,包含部分错误信息处理方法;
操作手记,留此备查
/*
导入
*/
--错误信息如下时:
--Msg 15281, Level 16, State 1, Line 2
--SQL Server blocked access to STATEMENT 'OpenRowset/OpenDatasource' of component 'Ad Hoc Distributed Queries' because this component is turned off as ......
通过v$sqlarea,v$sql查询最占用资源的查询 收藏
引用:http://blog.chinaunix.net/u/3866/showart_396335.html
-----------------------
v$sqlarea,v$sql
-----------------------
从V$SQLAREA中查询最占用资源的查询
select b.username username,a.disk_reads reads,
a.executions exec,a ......
使用SQL Server身份验证登录时报错:
无法连接到.\SQLEXPRESS.
Additional information:
用户'sa'登录失败。该用户与可信SQL Server 连接无关联。(microsoft SQL Server,Error:18452))
------------------
下面是映射时报的错:
创建对于用户“sa”失败。(microsoft.sqlServer.express.smo)
Additional ......
优化器在形成执行计划时需要做的一个重要选择是如何从数据库查询出需要的数据。对于SQL语句存取的任何表中的任何行,可能存在许多存取路径(存取方法),通过它们可以定位和查询出需要的数据。优化器选择其中自认为是最优化的路径。
在物理层,oracle读取数据,一次读取的最小单位为数据库块(由多个连续的操作系统块组成 ......