数据字典(SQL语句)
declare @tmp table
(
id int identity(1,1),
TableName varchar(100),
Column_name varchar(100),
Type varchar(50),
Lenght int,
Scale int,
Nullable varchar(1),
Defaults varchar(4000),
PrimaryKey varchar(1)
)
select iid = identity(int,1,1), * into #a from SysObjects where xtype = 'U'
declare @i int
declare @max int
declare @table varchar(100)
set @i = 1
select @max = max(iid) from #a
while @i <= @max
begin
select @table = name from #a where iid = @i
if @@rowcount > 0
begin
insert @tmp (TableName, Column_name, Type, Lenght, Scale, Nullable, Defaults,PrimaryKey)
select @table, a.name, c.name, a.length, a.xscale, case a.isnullable when 0 then 'N' else 'Y' end, isnull(d.text,''), case when x.PrimaryKey is null then '' else x.PrimaryKey end
from SysColumns a with(nolock)
inner join (select * from SysObjects with(nolock) where xtype = 'U' and id = object_id(@table)) b on a.id = b.id
inner join SysTypes c with(nolock) on a.xtype = c.xusertype
left join syscomments d with(nolock) on a.cdefault = d.id
left join
(select f.id, colid, 'Y' as PrimaryKey from SysIndexKeys f with(nolock), SysIndexes e, SysObjects g
where f.id = e.id and f.indid = e.indid and f.id = g.parent_obj and e.name = g.name
and g.xtype = 'PK' and g. parent_obj = object_id(@table)) x on a.id = x.id and a.colid = x.colid
end
set @i = @i + 1
end
select * from @tmp
相关文档:
系统环境:Windows 7
软件环境:Visual C++ 2008 SP1 +SQL Server 2005
本次目的:编写一个航空管理系统
这是数据库课程设计的成果,虽然成绩不佳,但是作为我用VC++ 以来编写的最大程序还是传到网上,以供参考。用VC++ 做数据库设计并不容易,但也不是不可能。以下是我的程序界面,后面 ......
FileStream:文件流,为了解决大对象BLOB(Binary Large Objects)的存储问题.对于大对象存储,并且不受2GB的限制.
以往有两种方式:
(1)存储在数据库里面,这种方式一般使用image字段,或者varbinary(max)来做,好处是可以统一备份,但实际效率较低;
(2)存储在文件系统,而数据库中存储文件路径,这种方式数据库压力减轻了,但却不方 ......
DUMP TRANSACTION testdb WITH NO_LOG
BACKUP LOG testdb WITH NO_LOG
DBCC SHRINKDATABASE(testdb ......
在SQL SERVER2000企业管理器下,SQL Server组里已经加如了 新建SQL Server 注册
比如:在可用的服务器(V)文本框中输入了:192.138.2.66然后点击 添加到服务器,当注册成功后
,当然192.138.2.66里面有 一个名为 kangaroo的数据库, 我现在的问题是:
怎么把 ......
---------数学函数 ---------------
1.绝对值
S:select abs(-1) value
O:select abs(-1) value from dual
2.取整(大)
S:select ceiling(-1.001) value
O:select ceil(-1.001) value from dual
3.取整(小)
S:select floor(-1.001) value
O:select floor(-1.001) value from ......