All articles(网络文学目录) All Pictures(图片目录) All Softwares(软件目录)

 
SQL2000系统表的应用_[SQL,Server教程]

Writer: 归海一刀 Article type: Programming skills(编程技巧) Time: 2014/2/1 0:13:38 Browse times: 379 Comment times: 0

SQL2000系统表的应用_[SQL,Server教程]


Head photo

Go homepage
Upload pictures
Write articles

SQL2000系统表的应用_[SQL Server教程]

--1:获取当前数据库中的所有用户表

select Name from sysobjects where xtype='u' and status>=0

--2:获取某一个表的所有字段

select name from syscolumns where id=object_id('表名')

--3:查看与某一个表相关的视图、存储过程、函数

select a.* from sysobjects a, syscomments b where a.id = b.id and b.text like '%表名%'

--4:查看当前数据库中所有存储过程

select name as 存储过程名称 from sysobjects where xtype='P'

--5:查询用户创建的所有数据库

select * from master..sysdatabases D where sid not in(select sid from master..syslogins where name='sa')

或者

select dbid, name AS DB_NAME from master..sysdatabases where sid <> 0x01

--6:查询某一个表的字段和数据类型

select column_name,data_type from information_schema.columns
where table_name = '表名'





There are 0 records,
Comment:
Must be registered users to comment(必须是注册用户才能发表评论)

Disclaimer Privacy Policy About us Site Map
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.