<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>家有小虎 &#187; SQL Server</title>
	<atom:link href="http://jiahu.net/tag/sql-server/feed" rel="self" type="application/rss+xml" />
	<link>http://jiahu.net</link>
	<description>我在路上, 你不在身旁. 想你的时候, 温暖依然.</description>
	<lastBuildDate>Fri, 23 Mar 2012 04:47:12 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>An insufficient number of arguments were supplied for the procedure or function ft_ParseCommaString.</title>
		<link>http://jiahu.net/an-insufficient-number-of-arguments-were-supplied-for-the-procedure-or-function-ft_parsecommastring.htm</link>
		<comments>http://jiahu.net/an-insufficient-number-of-arguments-were-supplied-for-the-procedure-or-function-ft_parsecommastring.htm#comments</comments>
		<pubDate>Thu, 26 Feb 2009 10:13:54 +0000</pubDate>
		<dc:creator>@ouc</dc:creator>
				<category><![CDATA[工作]]></category>
		<category><![CDATA[技术]]></category>
		<category><![CDATA[Script]]></category>
		<category><![CDATA[SQL Server]]></category>

		<guid isPermaLink="false">http://cngator.net/?p=887</guid>
		<description><![CDATA[from the MSSQL manual When a parameter of the function has a default value, the keyword “default” must be specified when calling the function in order to get the default value. This behavior is different from parameters with default values in stored procedures in which omitting the parameter also implies the default value. Source: http://forums.devshed.com/ms-sql-development-95/optional-parameters-on-create-function-149019.html]]></description>
			<content:encoded><![CDATA[<p><span id="intelliTxt">from the MSSQL manual</span></p>
<p><span id="intelliTxt"><br />
When a parameter of the function has a default value, the keyword “default” must be specified<br />
when calling the function in order to get the default value. </span></p>
<p><span id="intelliTxt"><br />
This behavior is different from parameters with default values in stored procedures<br />
in which omitting the parameter also implies the default value.</span></p>
<p><span>Source: <a href="http://forums.devshed.com/ms-sql-development-95/optional-parameters-on-create-function-149019.html" target="_blank">http://forums.devshed.com/ms-sql-development-95/optional-parameters-on-create-function-149019.html</a><br />
</span></p>
]]></content:encoded>
			<wfw:commentRss>http://jiahu.net/an-insufficient-number-of-arguments-were-supplied-for-the-procedure-or-function-ft_parsecommastring.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>两个特别的存储过程</title>
		<link>http://jiahu.net/%e4%b8%a4%e4%b8%aa%e7%89%b9%e5%88%ab%e7%9a%84%e5%ad%98%e5%82%a8%e8%bf%87%e7%a8%8b.htm</link>
		<comments>http://jiahu.net/%e4%b8%a4%e4%b8%aa%e7%89%b9%e5%88%ab%e7%9a%84%e5%ad%98%e5%82%a8%e8%bf%87%e7%a8%8b.htm#comments</comments>
		<pubDate>Tue, 26 Aug 2008 02:35:01 +0000</pubDate>
		<dc:creator>@ouc</dc:creator>
				<category><![CDATA[工作]]></category>
		<category><![CDATA[技术]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[数据库]]></category>
		<category><![CDATA[脚本]]></category>

		<guid isPermaLink="false">http://cngator.net/?p=564</guid>
		<description><![CDATA[简介 sp_msforeachdb 和 sp_msforeachtable 是非常有用的存储过程, 他们允许你遍历SQL Server实例中的全部数据库和表, 并对这些数据库和表执行命令. 我作为一个DBA每天都在使用它们. 两个存储过程都使用问号(?)作为一个置换符. 对于sp_msforeachdb, “?”表示数据库名称, 对于sp_msforeachtable, “?”表示表名称. sp_msforeachdb 示例 #1 &#8211; 可以使用以下命令检查实例中的每个数据库: sp_msforeachdb &#8216;dbcc checkdb( ”?” )&#8217; 示例 #2 &#8211; 修改实例中所有数据库的所有者为sa. sp_msforeachdb &#8216;IF ”?” NOT IN (”master”, ”model”, ”msdb”, ”tempdb”) BEGIN print ”?” exec [?].dbo.sp_changedbowner ”sa” END&#8217; **注意: 我使用if语句来过滤掉系统数据库 示例 #3 &#8211; 可以使用以下命令检查数据库中的每个表: sp_msforeachdb &#8216;dbcc checktable( ”?” )&#8217; <a href="http://jiahu.net/%e4%b8%a4%e4%b8%aa%e7%89%b9%e5%88%ab%e7%9a%84%e5%ad%98%e5%82%a8%e8%bf%87%e7%a8%8b.htm"> read more <span class="meta-nav">&#187;</span></a>]]></description>
			<content:encoded><![CDATA[<p>简介</p>
<p>sp_msforeachdb 和 sp_msforeachtable 是非常有用的存储过程, 他们允许你遍历SQL Server实例中的全部数据库和表, 并对这些数据库和表执行命令. 我作为一个DBA每天都在使用它们. 两个存储过程都使用问号(?)作为一个置换符. 对于sp_msforeachdb, “?”表示数据库名称, 对于sp_msforeachtable, “?”表示表名称.<br />
<strong>sp_msforeachdb</strong></p>
<p>示例 #1 &#8211; 可以使用以下命令检查实例中的每个数据库:</p>
<p>sp_msforeachdb &#8216;dbcc checkdb( ”?” )&#8217;</p>
<p>示例 #2 &#8211; 修改实例中所有数据库的所有者为sa.</p>
<p>sp_msforeachdb &#8216;IF ”?” NOT IN (”master”, ”model”, ”msdb”, ”tempdb”)<br />
BEGIN<br />
print ”?”<br />
exec [?].dbo.sp_changedbowner ”sa”<br />
END&#8217;</p>
<p>**注意: 我使用if语句来过滤掉系统数据库</p>
<p>示例 #3 &#8211; 可以使用以下命令检查数据库中的每个表:</p>
<p>sp_msforeachdb &#8216;dbcc checktable( ”?” )&#8217;</p>
<p>示例 #4 &#8211; 压缩实例中的所有数据库. 谨慎使用这个命令. 不要在业务时间使用在业务数据库上.</p>
<p>sp_msforeachdb &#8216;dbcc ShrinkDatabase( ?, 10 )&#8217;</p>
<p>示例 #5 &#8211; 为实例中所有数据库添加用户 db_owner. 通常使用在SharePoint安装补丁上.</p>
<p>sp_msforeachdb &#8216;IF ”?” NOT IN (”master”, ”model”, ”msdb”, ”tempdb”)<br />
BEGIN<br />
print ”?”</p>
<p>exec [?].dbo.sp_adduser ”&lt;YOUR DOMAIN NAME HERE&gt;\&lt;YOUR USER ACCOUNT HERE&gt;”<br />
exec [?].dbo.sp_addrolemember ”db_owner”,”&lt;YOUR DOMAIN NAME HERE&gt;\<br />
&lt;YOUR USER ACCOUNT HERE”<br />
END&#8217;</p>
<p><strong>sp_msforeachtable</strong></p>
<p>相当于sp_msforeachdb, 存储过程sp_msforeachtable在命令中使用”?”来代替表名称.</p>
<p>示例 #1 &#8211; 获取索引列表, 以及索引的统计数据.</p>
<p>CREATE table #stats(<br />
table_name nvarchar(255) null,<br />
index_name nvarchar(255) null,<br />
statistics_update_date datetime null<br />
)<br />
GO</p>
<p>exec sp_msforeachtable<br />
&#8216;insert into #stats<br />
SELECT<br />
”?”,<br />
name AS index_name,<br />
STATS_DATE(object_id, index_id) AS statistics_update_date<br />
FROM<br />
sys.indexes<br />
WHERE<br />
object_id = OBJECT_ID(”?”);&#8217;</p>
<p>select * from #stats where index_name is not null</p>
<p>drop table #stats</p>
<p>有上百万人在使用这些存储过程, 可能不止这些. 你甚至可以组合使用sp_msforeachtable和sp_msforeachdb. 享受它们, 同时小心使用.</p>
<p>原文: <a title="SQL Server, Store Procedure" href="http://www.codeproject.com/KB/database/sql_server_hidden.aspx" target="_blank">SQL Server Hidden Stored Procedures</a></p>
<p>作者: <strong><a href="http://www.codeproject.com/script/Membership/Profiles.aspx?mid=1766896">Michael Ceranski</a></strong></p>
<p>PS: 很久没有做过翻译了, 但是这篇实在是很值得推荐, 顺便复习一下自己的英语. 希望没有给大家带来混乱:-)</p>
]]></content:encoded>
			<wfw:commentRss>http://jiahu.net/%e4%b8%a4%e4%b8%aa%e7%89%b9%e5%88%ab%e7%9a%84%e5%ad%98%e5%82%a8%e8%bf%87%e7%a8%8b.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

