惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Forbes - Security
Forbes - Security
GbyAI
GbyAI
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
S
SegmentFault 最新的问题
Y
Y Combinator Blog
Recorded Future
Recorded Future
博客园 - Franky
I
InfoQ
T
The Blog of Author Tim Ferriss
Recent Announcements
Recent Announcements
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
博客园_首页
阮一峰的网络日志
阮一峰的网络日志
T
Tailwind CSS Blog
Cyberwarzone
Cyberwarzone
The Register - Security
The Register - Security
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
雷峰网
雷峰网
P
Palo Alto Networks Blog
G
GRAHAM CLULEY
Cloudbric
Cloudbric
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
MongoDB | Blog
MongoDB | Blog
F
Full Disclosure
Google DeepMind News
Google DeepMind News
Recent Commits to openclaw:main
Recent Commits to openclaw:main
C
Check Point Blog
爱范儿
爱范儿
The GitHub Blog
The GitHub Blog
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
W
WeLiveSecurity
T
Threat Research - Cisco Blogs
U
Unit 42
N
Netflix TechBlog - Medium
The Cloudflare Blog
Spread Privacy
Spread Privacy
Microsoft Azure Blog
Microsoft Azure Blog
美团技术团队
T
Troy Hunt's Blog
Engineering at Meta
Engineering at Meta
H
Heimdal Security Blog
TaoSecurity Blog
TaoSecurity Blog
C
Cybersecurity and Infrastructure Security Agency CISA
T
Tenable Blog
B
Blog
S
Securelist
H
Hacker News: Front Page
Google Online Security Blog
Google Online Security Blog
G
Google Developers Blog

博客园 - 潘伟

linux下快速查找文件大全 终于明白vi的用法了 什么是虚拟主机,为什么要使用虚拟主机? 一个存储前辈的一些业界知识(待了解) 10秒为任意数据库增加执行日志功能 - 潘伟 - 博客园 运动会的收获 从无奈到偷笑 一曲彩虹天堂 使用sql server中的全文索引经过大体的4个步骤 索引的创建 经常遇到的字段合并的问题 匹配符详解 数据库中的正则表达试 使用SQLServer2000 发送邮件详细配置过程 求记录中的最新数据的方法! 关于sql mail的配置问题(微软技术支持) 数据库设计范式深入浅出 锁定数据库的一个表_概述 约束的使用
系统表的应用
潘伟 · 2005-12-05 · via 博客园 - 潘伟

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

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

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

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

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

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

--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 = N'表名'

--7:获取数据库文件路径

select ltrim(rtrim(filename)) from 数据库名..sysfiles where charindex('MDF',filename)>0
or
select ltrim(rtrim(filename)) from 数据库名..sysfiles where charindex('LDF',filename)>0

--8:获取某一个表的基本信息

sp_MShelpcolumns N'表名'