<?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>days of linnchord &#187; Sql Server</title>
	<atom:link href="http://linnchord.net/archives/tag/sql-server/feed" rel="self" type="application/rss+xml" />
	<link>http://linnchord.net</link>
	<description>南台静坐 : : :</description>
	<lastBuildDate>Thu, 03 Nov 2011 02:22:39 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>SQL Server 2005 中的分区表和索引</title>
		<link>http://linnchord.net/archives/68.html</link>
		<comments>http://linnchord.net/archives/68.html#comments</comments>
		<pubDate>Wed, 05 Jul 2006 22:31:33 +0000</pubDate>
		<dc:creator>linnchord</dc:creator>
				<category><![CDATA[存照]]></category>
		<category><![CDATA[软件开发]]></category>
		<category><![CDATA[Sql Server]]></category>

		<guid isPermaLink="false">http://linnchord.net/2006/07/sql-server-2005-%e4%b8%ad%e7%9a%84%e5%88%86%e5%8c%ba%e8%a1%a8%e5%92%8c%e7%b4%a2%e5%bc%95/</guid>
		<description><![CDATA[http://www.microsoft.com/china/msdn/library/data/sqlserver/sql2k5partition.mspx?mfr=true]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.microsoft.com/china/msdn/library/data/sqlserver/sql2k5partition.mspx?mfr=true" target="_blank" class="en">http://www.microsoft.com/china/msdn/library/data/sqlserver/sql2k5partition.mspx?mfr=true</a></p>
]]></content:encoded>
			<wfw:commentRss>http://linnchord.net/archives/68.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SCOPE_IDENTITY、IDENT_CURRENT 和 @@IDENTITY</title>
		<link>http://linnchord.net/archives/87.html</link>
		<comments>http://linnchord.net/archives/87.html#comments</comments>
		<pubDate>Fri, 21 Jan 2005 12:42:00 +0000</pubDate>
		<dc:creator>linnchord</dc:creator>
				<category><![CDATA[软件开发]]></category>
		<category><![CDATA[Sql Server]]></category>

		<guid isPermaLink="false">http://linnchord.net/2005/01/scope_identity%e3%80%81ident_current-%e5%92%8c-identity/</guid>
		<description><![CDATA[SQL Server 2000中，有三个比较类似的功能：他们分别是：SCOPE_IDENTITY、IDENT_CURRENT 和 @@IDENTITY，它们都返回插入到 IDENTITY 列中的值。 1) IDENT_CURRENT 返回为任何会话和任何作用域中的特定表最后生成的标识值。它不受作用域和会话的限制，而受限于指定的表。 2) @@IDENTITY 返回为当前会话的所有作用域中的任何表最后生成的标识值。 3) SCOPE_IDENTITY 返回为当前会话和当前作用域中的任何表最后生成的标识值 SCOPE_IDENTITY 和 @@IDENTITY 返回在当前会话中的任何表内所生成的最后一个标识值。但是，SCOPE_IDENTITY 只返回插入到当前作用域中的值；@@IDENTITY 不受限于特定的作用域。 例如，有两个表 T1 和 T2，在 T1 上定义了一个 INSERT 触发器。当将某行插入 T1 时，触发器被激发，并在 T2 中插入一行。此例说明了两个作用域：一个是在 T1 上的插入，另一个是作为触发器的结果在 T2 上的插入。 假设 T1 和 T2 都有 IDENTITY 列，@@IDENTITY 和 SCOPE_IDENTITY 将在 T1 上的 INSERT 语句的最后返回不同的值。 @@IDENTITY 返回插入到当前会话中任何作用域内的最后一个 IDENTITY [...]]]></description>
			<content:encoded><![CDATA[<p>SQL Server 2000中，有三个比较类似的功能：他们分别是：SCOPE_IDENTITY、IDENT_CURRENT 和 @@IDENTITY，它们都返回插入到 IDENTITY 列中的值。 </p>
<p>1) IDENT_CURRENT 返回为任何会话和任何作用域中的特定表最后生成的标识值。它不受作用域和会话的限制，而受限于指定的表。 <br />2) @@IDENTITY 返回为当前会话的所有作用域中的任何表最后生成的标识值。 <br />3) SCOPE_IDENTITY 返回为当前会话和当前作用域中的任何表最后生成的标识值 </p>
<p>SCOPE_IDENTITY 和 @@IDENTITY 返回在当前会话中的任何表内所生成的最后一个标识值。但是，SCOPE_IDENTITY 只返回插入到当前作用域中的值；@@IDENTITY 不受限于特定的作用域。 </p>
<p>例如，有两个表 T1 和 T2，在 T1 上定义了一个 INSERT 触发器。当将某行插入 T1 时，触发器被激发，并在 T2 中插入一行。此例说明了两个作用域：一个是在 T1 上的插入，另一个是作为触发器的结果在 T2 上的插入。 </p>
<p>假设 T1 和 T2 都有 IDENTITY 列，@@IDENTITY 和 SCOPE_IDENTITY 将在 T1 上的 INSERT 语句的最后返回不同的值。 </p>
<p>@@IDENTITY 返回插入到当前会话中任何作用域内的最后一个 IDENTITY 列值，该值是插入 T2 中的值。 </p>
<p>SCOPE_IDENTITY() 返回插入 T1 中的 IDENTITY 值，该值是发生在相同作用域中的最后一个 INSERT。如果在作用域中发生插入语句到标识列之前唤醒调用 SCOPE_IDENTITY() 函数，则该函数将返回 NULL 值。 </p>
<p>而IDENT_CURRENT(&#8216;T1&#8242;) 和 IDENT_CURRENT(&#8216;T2&#8242;) 返回的值分别是这两个表最后自增的值。 </p>
]]></content:encoded>
			<wfw:commentRss>http://linnchord.net/archives/87.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

