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

推荐订阅源

Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Stack Overflow Blog
Stack Overflow Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
大猫的无限游戏
大猫的无限游戏
爱范儿
爱范儿
WordPress大学
WordPress大学
B
Blog RSS Feed
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
人人都是产品经理
人人都是产品经理
J
Java Code Geeks
酷 壳 – CoolShell
酷 壳 – CoolShell
小众软件
小众软件
MyScale Blog
MyScale Blog
GbyAI
GbyAI
Martin Fowler
Martin Fowler
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
博客园 - 聂微东
The Cloudflare Blog
L
Lohrmann on Cybersecurity
Apple Machine Learning Research
Apple Machine Learning Research
I
InfoQ
Google DeepMind News
Google DeepMind News
S
Securelist
Application and Cybersecurity Blog
Application and Cybersecurity Blog
博客园 - 【当耐特】
Latest news
Latest news
T
Threatpost
量子位
Y
Y Combinator Blog
T
Troy Hunt's Blog
Know Your Adversary
Know Your Adversary
MongoDB | Blog
MongoDB | Blog
罗磊的独立博客
博客园_首页
AWS News Blog
AWS News Blog
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
宝玉的分享
宝玉的分享
Project Zero
Project Zero
V
Visual Studio Blog
F
Fortinet All Blogs
S
Security Affairs
The Register - Security
The Register - Security
G
Google Developers Blog
T
Tenable Blog
L
LINUX DO - 最新话题
The GitHub Blog
The GitHub Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
博客园 - 三生石上(FineUI控件)
T
The Exploit Database - CXSecurity.com
博客园 - Franky

博客园 - 谢小漫

弹出选择窗体控件(附源码) 获取枚举描述信息(Description)2 - 谢小漫 - 博客园 mshtml组件引用的问题 Sql Server数据导出EXCEL C#的串口编程 DataReceived XML-RPC.NET的X509Certificates如何使用呢 XML-RPC.NET 在读《C#和.NET 2.0实战》 如何在ASP.NET中做异步 如何在winform中用委托做异步 C#的串口编程 重新开始学习.net 在看Test-Driven Development In Microsoft .NET 最近了解过的一个支付接口 网站的第三天 BAIDU的第一个搜索访问进入网站 不错的日期选择 星期六提交sitemap 关于代码自动生成器
导出所有用户表到excel
谢小漫 · 2009-04-30 · via 博客园 - 谢小漫

导出所有用户表到excel,结合上一个发的存储过程。

/*-- 
导出所有用户表到excel
--
*/
CREATE proc 导出所有用户表
as DECLARE @tb_name varchar(300)DECLARE tbname_cursor CURSOR FOR
select o.name from dbo.sysobjects o 
where OBJECTPROPERTY(o.id, N'IsUserTable'= 1 
and o.name<>'dtproperties'
order by o.nameOPEN tbname_cursor-- Perform the first fetch and store the values in variables.
--
 Note: The variables are in the same order as the columns
--
 in the SELECT statement. 

FETCH NEXT FROM tbname_cursor
INTO @tb_name-- Check @@FETCH_STATUS to see if there are any more rows to fetch.
WHILE @@FETCH_STATUS = 0
BEGIN--导出所有用户表
   exec('p_exporttb @sqlstr=''select * from '+@tb_name+' '',@path=''c:\abc'',@fname='''+@tb_name+'.xls'',@sheetname='''+@tb_name+'''')FETCH NEXT FROM tbname_cursor
   
INTO @tb_nameENDCLOSE tbname_cursor
DEALLOCATE tbname_cursor