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

推荐订阅源

博客园 - 叶小钗
云风的 BLOG
云风的 BLOG
G
Google Developers Blog
S
SegmentFault 最新的问题
罗磊的独立博客
Hugging Face - Blog
Hugging Face - Blog
美团技术团队
爱范儿
爱范儿
博客园 - 三生石上(FineUI控件)
H
Hackread – Cybersecurity News, Data Breaches, AI and More
D
DataBreaches.Net
F
Fortinet All Blogs
TaoSecurity Blog
TaoSecurity Blog
D
Docker
C
Cybersecurity and Infrastructure Security Agency CISA
K
Kaspersky official blog
宝玉的分享
宝玉的分享
腾讯CDC
Google Online Security Blog
Google Online Security Blog
Recorded Future
Recorded Future
T
The Exploit Database - CXSecurity.com
T
The Blog of Author Tim Ferriss
V
V2EX
S
Securelist
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
C
CERT Recently Published Vulnerability Notes
A
Arctic Wolf
Scott Helme
Scott Helme
L
LINUX DO - 热门话题
Y
Y Combinator Blog
P
Proofpoint News Feed
T
Tor Project blog
AWS News Blog
AWS News Blog
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
The Last Watchdog
The Last Watchdog
博客园 - 聂微东
T
Threat Research - Cisco Blogs
B
Blog
Attack and Defense Labs
Attack and Defense Labs
L
Lohrmann on Cybersecurity
C
CXSECURITY Database RSS Feed - CXSecurity.com
阮一峰的网络日志
阮一峰的网络日志
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
IT之家
IT之家
N
News and Events Feed by Topic
博客园 - 司徒正美
H
Help Net Security
C
Cisco Blogs
C
Check Point Blog
S
Secure Thoughts

博客园 - 山不转水转...

Windbg的First chance exception WPF 文本框焦点导致的内存泄露问题 产品功能被像素级抄袭了。我们拿什么来保护原创的产品设计? 显示器文字发虚的一种原因 HttpClient + IIS压缩动态内容 Windows 上第一款全局轮盘菜单软件(鼠标党进) C# Async Await 注意事项 MVC6的内置ActionResult类型 将long数字序列化为json时,转换为字符串 共享一个在线代码片段收集服务 清除ASPX页面中的meta:resourceKey="[a-zA-Z0-9]+" MVC 多语言记录1 设置默认的ResourceType knockoutjs with绑定导致unobtrusive validation失效的问题 那些年,我做共享软件(3)完结 那些年,我做共享软件(2) 那些年,我做共享软件(1) URTracker事务跟踪系统在软件企业中的应用 浅析缺陷管理系统URTracker 问题跟踪软件URTracker和Windows域的集成
查询SQL Server中所有数据库的数据文件位置
山不转水转... · 2013-01-19 · via 博客园 - 山不转水转...

2013-01-19 16:40  山不转水转...  阅读(1084)  评论()    收藏  举报

--drop table #dbfiles
--deallocate cursor1

------
declare cursor1 cursor for 
	SELECT name from sys.databases

-- 临时表
CREATE TABLE #dbfiles
( 
dbname nvarchar(100),
filetype nvarchar(100),
filename nvarchar(200)
)

declare @name  varchar(100) --数据库名
declare @sql nvarchar(1024) --临时sql 语句

open cursor1

fetch next from cursor1 into @name

while @@fetch_status = 0
begin	
	set @sql = 'INSERT INTO #dbfiles SELECT ''' + @name + ''',name,filename  from ' + @name + '.sys.sysfiles';
	EXEC(@sql)

	fetch next from cursor1 into @name	
end

close cursor1                   --关闭游标
deallocate cursor1

select * from #dbfiles

drop table #dbfiles --删除临时文件