Linux中国 Linux中国门户站!
设为主页 设为主页
收藏本站 收藏本站
 
当前位置 :首页 ->数据库应用 ->SQL Server ->正文

几段SQLServer语句和存储过程

来源:51CTO  作者:Webmaster 时间:2007-04-23 点击: [收藏] [投稿]

SET ANSI_NULLS ON

GO

SET NOCOUNT OFF

GO

select count(*)  from #t

DROP TABLE #t

GO

select count(*)-1  from #tc

select * into ##tx from #tc order by tablename

DROP TABLE #tc

--select * from ##tx

declare @db nvarchar(60),@sql nvarchar(3000)

set @db=db_name()

--请修改用户名和口令 导出到Excel 中

set @sql='exec master.dbo.xp_cmdshell ''bcp ..dbo.##tx out c:\'+@db+'_exp.xls -w -C936 -Usa -Psa '''

print @sql

exec(@sql)

GO

DROP TABLE ##tx

GO

-- ======================================================

--根据表中数据生成insert语句的存储过程



 如果您对本文有任何疑问或者建议,请到讨论区发表您的意见: >> 论坛入口 <<



上一篇:在SQLSERVER2005中实现素数计算   下一篇:SQLServer2005的一般部署步骤

文章评论】 【收藏本文】 【推荐好友】 【打印本文】 【我要投稿】 【论坛讨论
更多相关文章
Power by linux-cn.com 粤ICP备05006655号