<?xml version="1.0" encoding="utf-8"?><!-- generator="b2evolution/6.11.7-stable" -->
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:admin="http://webns.net/mvcb/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>Christoph Ingenhaag - Kategorie: "TSQL"</title>
		<link>https://www.insidesql.org/blogs/christoph_ingenhaag/</link>
		<atom:link rel="self" type="application/rss+xml" href="https://www.insidesql.org/blogs/christoph_ingenhaag/?tempskin=_rss2" />
		<description>InsideSQL.org Blogs - Blogs über SQL Server</description>
		<language>de-DE</language>
		<docs>http://blogs.law.harvard.edu/tech/rss</docs>
		<admin:generatorAgent rdf:resource="http://b2evolution.net/?v=6.11.7-stable"/>
		<ttl>60</ttl>
				<item>
			<title>Trennzeichen getrennten String sortieren</title>
			<link>https://www.insidesql.org/blogs/christoph_ingenhaag/2011/02/28/trennzeichen-getrennten-string-sortieren</link>
			<pubDate>Mon, 28 Feb 2011 21:09:45 +0000</pubDate>			<dc:creator>Christoph Ingenhaag</dc:creator>
			<category domain="main">TSQL</category>			<guid isPermaLink="false">2713@https://www.insidesql.org/blogs/</guid>
						<description>&lt;p&gt;&lt;!--  /* Font Definitions */  @font-face 	{font-family:Calibri; 	panose-1:2 15 5 2 2 2 4 3 2 4;}  /* Style Definitions */  p.MsoNormal, li.MsoNormal, div.MsoNormal 	{margin-top:40.0pt; 	margin-right:0cm; 	margin-bottom:6.0pt; 	margin-left:0cm; 	font-size:11.0pt; 	font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;} .MsoChpDefault 	{font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;} .MsoPapDefault 	{margin-top:40.0pt; 	margin-right:0cm; 	margin-bottom:6.0pt; 	margin-left:0cm;} @page WordSection1 	{size:612.0pt 792.0pt; 	margin:70.85pt 70.85pt 2.0cm 70.85pt;} div.WordSection1 	{page:WordSection1;} --&gt;&lt;/p&gt;
&lt;div class=&quot;WordSection1&quot;&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;Manchmal braucht man Dinge...&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt; &lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;&quot; lang=&quot;EN-US&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: fuchsia;&quot;&gt;object_id&lt;/span&gt;&lt;span style=&quot;color:gray&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;&#039;dbo.OrderStringparts&#039;&lt;/span&gt;&lt;span style=&quot;color:gray&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color:gray&quot;&gt;is&lt;/span&gt; &lt;span style=&quot;color:gray&quot;&gt;not&lt;/span&gt; &lt;span style=&quot;color: gray;&quot;&gt;NULL&lt;/span&gt; &lt;span style=&quot;color:blue&quot;&gt;drop&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;function&lt;/span&gt; &lt;span style=&quot;color:teal&quot;&gt;dbo&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color:teal&quot;&gt;OrderStringparts&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;&quot;&gt;go&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;&quot;&gt; &lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;&quot; lang=&quot;EN-US&quot;&gt;create&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;function&lt;/span&gt; &lt;span style=&quot;color:teal&quot;&gt;dbo&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color:teal&quot;&gt;OrderStringparts&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: gray;&quot; lang=&quot;EN-US&quot;&gt;(&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: teal;&quot;&gt;@String&lt;/span&gt; &lt;span style=&quot;color:blue&quot;&gt;nvarchar&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color:fuchsia&quot;&gt;max&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;),&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: teal;&quot;&gt;@Delimiter&lt;/span&gt; &lt;span style=&quot;color:blue&quot;&gt;nvarchar&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color:fuchsia&quot;&gt;max&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: gray;&quot; lang=&quot;EN-US&quot;&gt;)&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;&quot; lang=&quot;EN-US&quot;&gt;returns&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;nvarchar&lt;/span&gt;&lt;span style=&quot;color:gray&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: fuchsia;&quot;&gt;max&lt;/span&gt;&lt;span style=&quot;color:gray&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;&quot; lang=&quot;EN-US&quot;&gt;as&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt; &lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;&quot; lang=&quot;EN-US&quot;&gt;begin&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;&quot; lang=&quot;EN-US&quot;&gt; &lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;declare&lt;/span&gt; &lt;span style=&quot;color:teal&quot;&gt;@out&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;nvarchar&lt;/span&gt;&lt;span style=&quot;color:gray&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: fuchsia;&quot;&gt;max&lt;/span&gt;&lt;span style=&quot;color:gray&quot;&gt;);&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: gray;&quot; lang=&quot;EN-US&quot;&gt; &lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;with&lt;/span&gt; &lt;span style=&quot;color:teal&quot;&gt;tab&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color:teal&quot;&gt;Part&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color:blue&quot;&gt;as&lt;/span&gt; &lt;span style=&quot;color: green;&quot;&gt;-- http://www.sommarskog.se/arrays-in-sql-2005.html#tblnum&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;&quot; lang=&quot;EN-US&quot;&gt; &lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: gray;&quot; lang=&quot;EN-US&quot;&gt;(&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;select&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: fuchsia;&quot;&gt;substring&lt;/span&gt;&lt;span style=&quot;color:gray&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;@String&lt;/span&gt;&lt;span style=&quot;color:gray&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;n&lt;/span&gt;&lt;span style=&quot;color:gray&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: fuchsia;&quot;&gt;charindex&lt;/span&gt;&lt;span style=&quot;color:gray&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;@delimiter&lt;/span&gt;&lt;span style=&quot;color:gray&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@String&lt;/span&gt; &lt;span style=&quot;color:gray&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@delimiter&lt;/span&gt;&lt;span style=&quot;color:gray&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;n&lt;/span&gt;&lt;span style=&quot;color:gray&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: gray;&quot;&gt;-&lt;/span&gt; &lt;span style=&quot;color:teal&quot;&gt;n&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;from&lt;/span&gt; &lt;span style=&quot;color:teal&quot;&gt;dbo&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color:teal&quot;&gt;Numbers&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;(&lt;/span&gt;1&lt;span style=&quot;color:gray&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: fuchsia;&quot;&gt;len&lt;/span&gt;&lt;span style=&quot;color:gray&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;@String&lt;/span&gt;&lt;span style=&quot;color:gray&quot;&gt;))&lt;/span&gt; &lt;span style=&quot;color: green;&quot;&gt;-- http://stevekass.com/2006/06/03/how-to-generate-a-sequence-on-the-fly&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;where&lt;/span&gt; &lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: fuchsia;&quot;&gt;substring&lt;/span&gt;&lt;span style=&quot;color:gray&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;@delimiter&lt;/span&gt; &lt;span style=&quot;color:gray&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@String&lt;/span&gt;&lt;span style=&quot;color:gray&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;n&lt;/span&gt;&lt;span style=&quot;color:gray&quot;&gt;,&lt;/span&gt; &lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: fuchsia;&quot;&gt;len&lt;/span&gt;&lt;span style=&quot;color:gray&quot;&gt;(&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: fuchsia;&quot;&gt;replace&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt;(@delimiter&lt;/span&gt;&lt;span style=&quot;color:gray&quot;&gt;, &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;&#039; &#039;, &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;&#039;_&#039;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color:gray&quot;&gt;)))&lt;/span&gt; &lt;span style=&quot;color: gray;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color:teal&quot;&gt;@delimiter&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: gray;&quot;&gt;),&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: teal;&quot;&gt;string&lt;/span&gt;&lt;span style=&quot;color:gray&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;string&lt;/span&gt;&lt;span style=&quot;color:gray&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;as&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;&quot; lang=&quot;EN-US&quot;&gt; &lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: gray;&quot; lang=&quot;EN-US&quot;&gt;(&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;select&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: teal;&quot;&gt;@Delimiter&lt;/span&gt; &lt;span style=&quot;color:gray&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;Part&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;from&lt;/span&gt; &lt;span style=&quot;color:teal&quot;&gt;tab&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;order&lt;/span&gt; &lt;span style=&quot;color:blue&quot;&gt;by&lt;/span&gt; &lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: teal;&quot;&gt;Part&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;for&lt;/span&gt; &lt;span style=&quot;color:blue&quot;&gt;xml&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;path&lt;/span&gt;&lt;span style=&quot;color:gray&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;&#039;&#039;&lt;/span&gt;&lt;span style=&quot;color:gray&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: gray;&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;select&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt;@out&lt;/span&gt; &lt;span style=&quot;color: gray;&quot;&gt;=&lt;/span&gt; &lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: fuchsia;&quot;&gt;substring&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: gray;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;string&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt; 2&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;2147483647&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: gray;&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;span style=&quot;color: blue;&quot;&gt;from&lt;/span&gt; &lt;span style=&quot;color:teal&quot;&gt;string&lt;/span&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt; &lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt; &lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color:teal&quot;&gt;@out&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: teal;&quot; lang=&quot;EN-US&quot;&gt; &lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;&quot; lang=&quot;EN-US&quot;&gt;end&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;&quot; lang=&quot;EN-US&quot;&gt;go&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt; &lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;Viele Grüße&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;Christoph Ingenhaag&lt;/p&gt;
&lt;/div&gt;</description>
			<content:encoded><![CDATA[<p><!--  /* Font Definitions */  @font-face 	{font-family:Calibri; 	panose-1:2 15 5 2 2 2 4 3 2 4;}  /* Style Definitions */  p.MsoNormal, li.MsoNormal, div.MsoNormal 	{margin-top:40.0pt; 	margin-right:0cm; 	margin-bottom:6.0pt; 	margin-left:0cm; 	font-size:11.0pt; 	font-family:"Calibri","sans-serif";} .MsoChpDefault 	{font-family:"Calibri","sans-serif";} .MsoPapDefault 	{margin-top:40.0pt; 	margin-right:0cm; 	margin-bottom:6.0pt; 	margin-left:0cm;} @page WordSection1 	{size:612.0pt 792.0pt; 	margin:70.85pt 70.85pt 2.0cm 70.85pt;} div.WordSection1 	{page:WordSection1;} --></p>
<div class="WordSection1">
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none">Manchmal braucht man Dinge...</p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"> </span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;" lang="EN-US">if</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"> <span style="color: fuchsia;">object_id</span><span style="color:gray">(</span><span style="color: red;">'dbo.OrderStringparts'</span><span style="color:gray">)</span> <span style="color:gray">is</span> <span style="color:gray">not</span> <span style="color: gray;">NULL</span> <span style="color:blue">drop</span> <span style="color: blue;">function</span> <span style="color:teal">dbo</span><span style="color: gray;">.</span><span style="color:teal">OrderStringparts</span></span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">go</span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;"> </span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;" lang="EN-US">create</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"> <span style="color: blue;">function</span> <span style="color:teal">dbo</span><span style="color: gray;">.</span><span style="color:teal">OrderStringparts</span></span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: gray;" lang="EN-US">(</span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"> <span style="color: teal;">@String</span> <span style="color:blue">nvarchar</span><span style="color: gray;">(</span><span style="color:fuchsia">max</span><span style="color: gray;">),</span></span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"> <span style="color: teal;">@Delimiter</span> <span style="color:blue">nvarchar</span><span style="color: gray;">(</span><span style="color:fuchsia">max</span><span style="color: gray;">)</span></span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: gray;" lang="EN-US">)</span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;" lang="EN-US">returns</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"> <span style="color: blue;">nvarchar</span><span style="color:gray">(</span><span style="color: fuchsia;">max</span><span style="color:gray">)</span></span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;" lang="EN-US">as</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"> </span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;" lang="EN-US">begin</span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;" lang="EN-US"> </span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"> <span style="color: blue;">declare</span> <span style="color:teal">@out</span> <span style="color: blue;">nvarchar</span><span style="color:gray">(</span><span style="color: fuchsia;">max</span><span style="color:gray">);</span></span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: gray;" lang="EN-US"> </span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"> <span style="color: blue;">with</span> <span style="color:teal">tab</span><span style="color: gray;">(</span><span style="color:teal">Part</span><span style="color: gray;">)</span> <span style="color:blue">as</span> <span style="color: green;">-- http://www.sommarskog.se/arrays-in-sql-2005.html#tblnum</span></span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;" lang="EN-US"> </span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: gray;" lang="EN-US">(</span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"> <span style="color: blue;">select</span></span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"> <span style="color: fuchsia;">substring</span><span style="color:gray">(</span><span style="color: teal;">@String</span><span style="color:gray">,</span> <span style="color: teal;">n</span><span style="color:gray">,</span> <span style="color: fuchsia;">charindex</span><span style="color:gray">(</span><span style="color: teal;">@delimiter</span><span style="color:gray">,</span> <span style="color: teal;">@String</span> <span style="color:gray">+</span> <span style="color: teal;">@delimiter</span><span style="color:gray">,</span> <span style="color: teal;">n</span><span style="color:gray">)</span> <span style="color: gray;">-</span> <span style="color:teal">n</span><span style="color: gray;">)</span></span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"> <span style="color: blue;">from</span> <span style="color:teal">dbo</span><span style="color: gray;">.</span><span style="color:teal">Numbers</span><span style="color: gray;">(</span>1<span style="color:gray">,</span> <span style="color: fuchsia;">len</span><span style="color:gray">(</span><span style="color: teal;">@String</span><span style="color:gray">))</span> <span style="color: green;">-- http://stevekass.com/2006/06/03/how-to-generate-a-sequence-on-the-fly</span></span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"> <span style="color: blue;">where</span> </span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"> <span style="color: fuchsia;">substring</span><span style="color:gray">(</span><span style="color: teal;">@delimiter</span> <span style="color:gray">+</span> <span style="color: teal;">@String</span><span style="color:gray">,</span> <span style="color: teal;">n</span><span style="color:gray">,</span> </span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"><span style="color: fuchsia;">len</span><span style="color:gray">(</span></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"><span style="color: fuchsia;">replace</span></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"><span style="color: teal;">(@delimiter</span><span style="color:gray">, </span></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"><span style="color: red;">' ', </span></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"><span style="color: red;">'_'</span></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"><span style="color:gray">)))</span> <span style="color: gray;">=</span> <span style="color:teal">@delimiter</span></span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"> <span style="color: gray;">),</span></span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"> <span style="color: teal;">string</span><span style="color:gray">(</span><span style="color: teal;">string</span><span style="color:gray">)</span> <span style="color: blue;">as</span></span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;" lang="EN-US"> </span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: gray;" lang="EN-US">(</span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"> <span style="color: blue;">select</span></span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"> <span style="color: teal;">@Delimiter</span> <span style="color:gray">+</span> <span style="color: teal;">Part</span></span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"> <span style="color: blue;">from</span> <span style="color:teal">tab</span></span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"> <span style="color: blue;">order</span> <span style="color:blue">by</span> </span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"> <span style="color: teal;">Part</span></span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"> <span style="color: blue;">for</span> <span style="color:blue">xml</span> <span style="color: blue;">path</span><span style="color:gray">(</span><span style="color: red;">''</span><span style="color:gray">)</span></span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"> <span style="color: gray;">)</span></span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"> <span style="color: blue;">select</span></span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"><span style="color: teal;">@out</span> <span style="color: gray;">=</span> </span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"><span style="color: fuchsia;">substring</span></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"><span style="color: gray;">(</span><span style="color: teal;">string</span><span style="color: gray;">,</span></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"> 2</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"><span style="color: gray;">,</span></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"><span style="color: blue;"> </span></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US">2147483647</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"><span style="color: gray;">)</span></span></p>
<span style="color: blue;">from</span> <span style="color:teal">string</span>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"> </span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"> </span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"> <span style="color: blue;">return</span> <span style="color:teal">@out</span></span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: teal;" lang="EN-US"> </span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;" lang="EN-US">end</span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;" lang="EN-US">go</span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"> </p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none">Viele Grüße</p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none">Christoph Ingenhaag</p>
</div>]]></content:encoded>
								<comments>https://www.insidesql.org/blogs/christoph_ingenhaag/2011/02/28/trennzeichen-getrennten-string-sortieren#comments</comments>
			<wfw:commentRss>https://www.insidesql.org/blogs/christoph_ingenhaag/?tempskin=_rss2&#38;disp=comments&#38;p=2713</wfw:commentRss>
		</item>
				<item>
			<title>Fortlaufende Summe</title>
			<link>https://www.insidesql.org/blogs/christoph_ingenhaag/2011/02/28/fortlaufende-summe</link>
			<pubDate>Mon, 28 Feb 2011 21:09:02 +0000</pubDate>			<dc:creator>Christoph Ingenhaag</dc:creator>
			<category domain="main">TSQL</category>			<guid isPermaLink="false">2712@https://www.insidesql.org/blogs/</guid>
						<description>&lt;p&gt; &lt;/p&gt;
&lt;p&gt;Eine Möglichkeit, eine fortlaufende Summe zu erzeugen ist die Nachfolgende.&lt;/p&gt;
&lt;p&gt;Voraussetzung ist eine fortlaufende Nummer ohne Lücken und aus Gründen der Performance ein Index auf die fortlaufenden Nummer.&lt;/p&gt;
&lt;p&gt;Da man diese Voraussetzungen selten vorfindet, lege ich eine entsprechende temporäre Tabelle an, die diesen Voraussetzungen genügt.&lt;/p&gt;
&lt;p&gt;Aus den Testdaten&lt;/p&gt;
&lt;!--  /* Font Definitions */  @font-face 	{font-family:Calibri; 	panose-1:2 15 5 2 2 2 4 3 2 4;}  /* Style Definitions */  p.MsoNormal, li.MsoNormal, div.MsoNormal 	{margin-top:40.0pt; 	margin-right:0cm; 	margin-bottom:6.0pt; 	margin-left:0cm; 	font-size:11.0pt; 	font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;} .MsoChpDefault 	{font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;} .MsoPapDefault 	{margin-top:40.0pt; 	margin-right:0cm; 	margin-bottom:6.0pt; 	margin-left:0cm;} @page WordSection1 	{size:612.0pt 792.0pt; 	margin:70.85pt 70.85pt 2.0cm 70.85pt;} div.WordSection1 	{page:WordSection1;} --&gt;
&lt;div class=&quot;WordSection1&quot;&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;&quot; lang=&quot;EN-US&quot;&gt;begin&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;try&lt;/span&gt; &lt;span style=&quot;color:blue&quot;&gt;drop&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;table&lt;/span&gt; &lt;span style=&quot;color:teal&quot;&gt;##test&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color:teal&quot;&gt;#test&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;end&lt;/span&gt; &lt;span style=&quot;color:blue&quot;&gt;try&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;begin&lt;/span&gt; &lt;span style=&quot;color:blue&quot;&gt;catch&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;end&lt;/span&gt; &lt;span style=&quot;color:blue&quot;&gt;catch&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;&quot; lang=&quot;EN-US&quot;&gt; &lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;&quot; lang=&quot;EN-US&quot;&gt;select&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt; &lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt; n&lt;/span&gt; &lt;span style=&quot;color:blue&quot;&gt;as&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;ID&lt;/span&gt;&lt;span style=&quot;color:gray&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: fuchsia;&quot;&gt;cast&lt;/span&gt;&lt;span style=&quot;color:gray&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: fuchsia;&quot;&gt;abs&lt;/span&gt;&lt;span style=&quot;color:gray&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: fuchsia;&quot;&gt;checksum&lt;/span&gt;&lt;span style=&quot;color:gray&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: fuchsia;&quot;&gt;newid&lt;/span&gt;&lt;span style=&quot;color:gray&quot;&gt;()))&lt;/span&gt; &lt;span style=&quot;color: gray;&quot;&gt;*&lt;/span&gt; 1.0 &lt;span style=&quot;color:gray&quot;&gt;/&lt;/span&gt; 10000000 &lt;span style=&quot;color: blue;&quot;&gt;as&lt;/span&gt; &lt;span style=&quot;color:blue&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color:blue&quot;&gt;as&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;Betrag&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;&quot; lang=&quot;EN-US&quot;&gt;into&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: teal;&quot;&gt;##test&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;&quot; lang=&quot;EN-US&quot;&gt;from&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: teal;&quot;&gt;dbo&lt;/span&gt;&lt;span style=&quot;color:gray&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;numbers&lt;/span&gt;&lt;span style=&quot;color:gray&quot;&gt;(&lt;/span&gt;1&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt;100000&lt;span style=&quot;color:gray&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: green;&quot;&gt;-- http://stevekass.com/2006/06/03/how-to-generate-a-sequence-on-the-fly&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;&quot; lang=&quot;EN-US&quot;&gt;where&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt;n&lt;/span&gt; &lt;span style=&quot;color:gray&quot;&gt;%&lt;/span&gt; 3 &lt;span style=&quot;color: gray;&quot;&gt;=&lt;/span&gt; 1 &lt;span style=&quot;color:gray&quot;&gt;or&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt;n&lt;/span&gt; &lt;span style=&quot;color:gray&quot;&gt;%&lt;/span&gt; 5 &lt;span style=&quot;color: gray;&quot;&gt;=&lt;/span&gt; 1&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;&quot; lang=&quot;EN-US&quot;&gt;go&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt; &lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;erzeuge ich die temporäre Tabelle:&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;&quot; lang=&quot;EN-US&quot;&gt; &lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;&quot; lang=&quot;EN-US&quot;&gt;select&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: fuchsia;&quot;&gt;row_number&lt;/span&gt;&lt;span style=&quot;color:gray&quot;&gt;()&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;over &lt;/span&gt;&lt;span style=&quot;color:gray&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;order&lt;/span&gt; &lt;span style=&quot;color:blue&quot;&gt;by&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;ID&lt;/span&gt;&lt;span style=&quot;color:gray&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;as&lt;/span&gt; &lt;span style=&quot;color:teal&quot;&gt;RNR&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt;ID&lt;/span&gt;&lt;span style=&quot;color:gray&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt;Betrag&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;&quot; lang=&quot;EN-US&quot;&gt;into&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: teal;&quot;&gt;#test&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;&quot; lang=&quot;EN-US&quot;&gt;from&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: teal;&quot;&gt;##test&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;&quot; lang=&quot;EN-US&quot;&gt;go&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;&quot; lang=&quot;EN-US&quot;&gt; &lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;&quot; lang=&quot;EN-US&quot;&gt;create&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;unique&lt;/span&gt; &lt;span style=&quot;color:blue&quot;&gt;clustered&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;index&lt;/span&gt; &lt;span style=&quot;color:teal&quot;&gt;cuidx&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;on&lt;/span&gt; &lt;span style=&quot;color:teal&quot;&gt;#test&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color:teal&quot;&gt;RNR&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;&quot; lang=&quot;EN-US&quot;&gt;go&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt; &lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;Und hier die Abfrage&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;&quot; lang=&quot;EN-US&quot;&gt; &lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: gray;&quot; lang=&quot;EN-US&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;&quot; lang=&quot;EN-US&quot;&gt;with&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: teal;&quot;&gt;posten&lt;/span&gt; &lt;span style=&quot;color:blue&quot;&gt;as&lt;/span&gt; &lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: gray;&quot; lang=&quot;EN-US&quot;&gt;(&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;select&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt;RNR&lt;/span&gt;&lt;span style=&quot;color:gray&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt;ID&lt;/span&gt;&lt;span style=&quot;color:gray&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt;Betrag&lt;/span&gt;&lt;span style=&quot;color:gray&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt; 1 &lt;span style=&quot;color: blue;&quot;&gt;as&lt;/span&gt; &lt;span style=&quot;color:teal&quot;&gt;MinRNR&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: fuchsia;&quot;&gt;count&lt;/span&gt;&lt;span style=&quot;color:gray&quot;&gt;(*)&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;over &lt;/span&gt;&lt;span style=&quot;color:gray&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;partition&lt;/span&gt; &lt;span style=&quot;color:blue&quot;&gt;by&lt;/span&gt; 1&lt;span style=&quot;color: gray;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color:blue&quot;&gt;as&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;MaxRNR&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;from&lt;/span&gt; &lt;span style=&quot;color:teal&quot;&gt;#test&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: gray;&quot; lang=&quot;EN-US&quot;&gt;),&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: teal;&quot; lang=&quot;EN-US&quot;&gt;zeilenweise&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;as&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: gray;&quot; lang=&quot;EN-US&quot;&gt;(&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;select&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt;RNR&lt;/span&gt;&lt;span style=&quot;color:gray&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt; &lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: teal;&quot;&gt;ID&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: gray;&quot;&gt;,&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt;Betrag&lt;/span&gt;&lt;span style=&quot;color:gray&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt;Betrag&lt;/span&gt; &lt;span style=&quot;color:blue&quot;&gt;as&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;Summe&lt;/span&gt;&lt;span style=&quot;color:gray&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt;MinRNR&lt;/span&gt;&lt;span style=&quot;color:gray&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: teal;&quot; lang=&quot;EN-US&quot;&gt;MaxRNR&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;from&lt;/span&gt; &lt;span style=&quot;color:teal&quot;&gt;posten&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;where&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt;RNR&lt;/span&gt; &lt;span style=&quot;color:gray&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;MinRNR&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt; &lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt; &lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;union&lt;/span&gt; &lt;span style=&quot;color:gray&quot;&gt;all&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt; &lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt; &lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;select&lt;/span&gt; &lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt;z&lt;/span&gt;&lt;span style=&quot;color:gray&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;RNR&lt;/span&gt; &lt;span style=&quot;color:gray&quot;&gt;+&lt;/span&gt; 1&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt; &lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: teal;&quot;&gt;p&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: teal;&quot;&gt;ID&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: gray;&quot;&gt;,&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt;p&lt;/span&gt;&lt;span style=&quot;color:gray&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;Betrag&lt;/span&gt;&lt;span style=&quot;color:gray&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt;z&lt;/span&gt;&lt;span style=&quot;color:gray&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;Summe&lt;/span&gt; &lt;span style=&quot;color:gray&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;p&lt;/span&gt;&lt;span style=&quot;color:gray&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;Betrag&lt;/span&gt;&lt;span style=&quot;color:gray&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt;z&lt;/span&gt;&lt;span style=&quot;color:gray&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;MinRNR&lt;/span&gt;&lt;span style=&quot;color:gray&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt;z&lt;/span&gt;&lt;span style=&quot;color:gray&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;MaxRNR&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;span style=&quot;color:blue&quot;&gt;from&lt;/span&gt; &lt;span style=&quot;color:teal&quot;&gt;zeilenweise&lt;/span&gt; &lt;span style=&quot;color:teal&quot;&gt;z&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: gray;&quot; lang=&quot;EN-US&quot;&gt;inner&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: gray;&quot;&gt;join&lt;/span&gt; &lt;span style=&quot;color:teal&quot;&gt;posten&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;p&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;on&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt;p&lt;/span&gt;&lt;span style=&quot;color:gray&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;RNR&lt;/span&gt; &lt;span style=&quot;color:gray&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;z&lt;/span&gt;&lt;span style=&quot;color:gray&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;RNR&lt;/span&gt; &lt;span style=&quot;color:gray&quot;&gt;+&lt;/span&gt; 1&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;where&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt;z&lt;/span&gt;&lt;span style=&quot;color:gray&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;RNR&lt;/span&gt; &lt;span style=&quot;color:gray&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;z&lt;/span&gt;&lt;span style=&quot;color:gray&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;MaxRNR&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: gray;&quot; lang=&quot;EN-US&quot;&gt;)&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;&quot; lang=&quot;EN-US&quot;&gt;select&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt;ID&lt;/span&gt;&lt;span style=&quot;color:gray&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt; &lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: teal;&quot;&gt;Betrag&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: gray;&quot;&gt;,&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;span style=&quot;color:teal&quot;&gt;Summe&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;&quot;&gt;from&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt; &lt;span style=&quot;color:teal&quot;&gt;zeilenweise&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin:0cm;margin-bottom:.0001pt;text-autospace:none&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;&quot;&gt;option &lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: gray;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: teal;&quot;&gt;maxrecursion&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt; 0&lt;span style=&quot;color:gray&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot;&gt;Die Ausführungsgeschwindigkeit ist bis ca. 100.000 Datensätze durchaus annehmbar...&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot;&gt;Viele Grüße&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot;&gt;Christoph Ingenhaag&lt;/p&gt;
&lt;/div&gt;</description>
			<content:encoded><![CDATA[<p> </p>
<p>Eine Möglichkeit, eine fortlaufende Summe zu erzeugen ist die Nachfolgende.</p>
<p>Voraussetzung ist eine fortlaufende Nummer ohne Lücken und aus Gründen der Performance ein Index auf die fortlaufenden Nummer.</p>
<p>Da man diese Voraussetzungen selten vorfindet, lege ich eine entsprechende temporäre Tabelle an, die diesen Voraussetzungen genügt.</p>
<p>Aus den Testdaten</p>
<!--  /* Font Definitions */  @font-face 	{font-family:Calibri; 	panose-1:2 15 5 2 2 2 4 3 2 4;}  /* Style Definitions */  p.MsoNormal, li.MsoNormal, div.MsoNormal 	{margin-top:40.0pt; 	margin-right:0cm; 	margin-bottom:6.0pt; 	margin-left:0cm; 	font-size:11.0pt; 	font-family:"Calibri","sans-serif";} .MsoChpDefault 	{font-family:"Calibri","sans-serif";} .MsoPapDefault 	{margin-top:40.0pt; 	margin-right:0cm; 	margin-bottom:6.0pt; 	margin-left:0cm;} @page WordSection1 	{size:612.0pt 792.0pt; 	margin:70.85pt 70.85pt 2.0cm 70.85pt;} div.WordSection1 	{page:WordSection1;} -->
<div class="WordSection1">
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;" lang="EN-US">begin</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"> <span style="color: blue;">try</span> <span style="color:blue">drop</span> <span style="color: blue;">table</span> <span style="color:teal">##test</span><span style="color: gray;">,</span> <span style="color:teal">#test</span> <span style="color: blue;">end</span> <span style="color:blue">try</span> <span style="color: blue;">begin</span> <span style="color:blue">catch</span> <span style="color: blue;">end</span> <span style="color:blue">catch</span></span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;" lang="EN-US"> </span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;" lang="EN-US">select</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"> </span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"><span style="color: teal;"> n</span> <span style="color:blue">as</span> <span style="color: teal;">ID</span><span style="color:gray">,</span></span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"><span style="color: teal;"> </span></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"><span style="color: fuchsia;">cast</span><span style="color:gray">(</span><span style="color: fuchsia;">abs</span><span style="color:gray">(</span><span style="color: fuchsia;">checksum</span><span style="color:gray">(</span><span style="color: fuchsia;">newid</span><span style="color:gray">()))</span> <span style="color: gray;">*</span> 1.0 <span style="color:gray">/</span> 10000000 <span style="color: blue;">as</span> <span style="color:blue">int</span><span style="color: gray;">)</span> <span style="color:blue">as</span> <span style="color: teal;">Betrag</span></span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;" lang="EN-US">into</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"> <span style="color: teal;">##test</span></span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;" lang="EN-US">from</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"> <span style="color: teal;">dbo</span><span style="color:gray">.</span><span style="color: teal;">numbers</span><span style="color:gray">(</span>1<span style="color: gray;">,</span>100000<span style="color:gray">)</span> <span style="color: green;">-- http://stevekass.com/2006/06/03/how-to-generate-a-sequence-on-the-fly</span></span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;" lang="EN-US">where</span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"><span style="color: teal;"> </span></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"><span style="color: teal;">n</span> <span style="color:gray">%</span> 3 <span style="color: gray;">=</span> 1 <span style="color:gray">or</span></span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"><span style="color: teal;"> </span></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"><span style="color: teal;">n</span> <span style="color:gray">%</span> 5 <span style="color: gray;">=</span> 1</span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;" lang="EN-US">go</span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"> </p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none">erzeuge ich die temporäre Tabelle:</p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;" lang="EN-US"> </span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;" lang="EN-US">select</span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"><span style="color: teal;"> </span></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"><span style="color: fuchsia;">row_number</span><span style="color:gray">()</span> <span style="color: blue;">over </span><span style="color:gray">(</span><span style="color: blue;">order</span> <span style="color:blue">by</span> <span style="color: teal;">ID</span><span style="color:gray">)</span> <span style="color: blue;">as</span> <span style="color:teal">RNR</span><span style="color: gray;">,</span></span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"><span style="color: teal;"> </span></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"><span style="color: teal;">ID</span><span style="color:gray">,</span></span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"><span style="color: teal;"> </span></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"><span style="color: teal;">Betrag</span></span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;" lang="EN-US">into</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"> <span style="color: teal;">#test</span></span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;" lang="EN-US">from</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"> <span style="color: teal;">##test</span></span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;" lang="EN-US">go</span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;" lang="EN-US"> </span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;" lang="EN-US">create</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"> <span style="color: blue;">unique</span> <span style="color:blue">clustered</span> <span style="color: blue;">index</span> <span style="color:teal">cuidx</span> <span style="color: blue;">on</span> <span style="color:teal">#test</span><span style="color: gray;">(</span><span style="color:teal">RNR</span><span style="color: gray;">)</span></span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;" lang="EN-US">go</span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"> </p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none">Und hier die Abfrage</p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;" lang="EN-US"> </span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: gray;" lang="EN-US">;</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;" lang="EN-US">with</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"> <span style="color: teal;">posten</span> <span style="color:blue">as</span> </span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: gray;" lang="EN-US">(</span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"><span style="color: teal;"> </span></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"><span style="color: blue;">select</span></span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"><span style="color: teal;"> </span></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"><span style="color: teal;"> </span></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"><span style="color: teal;">RNR</span><span style="color:gray">,</span></span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"><span style="color: teal;"> </span></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"><span style="color: teal;"> </span></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"><span style="color: teal;">ID</span><span style="color:gray">,</span></span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"><span style="color: teal;"> </span></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"><span style="color: teal;"> </span></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"><span style="color: teal;">Betrag</span><span style="color:gray">,</span></span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"><span style="color: teal;"> </span></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"><span style="color: teal;"> </span></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"> 1 <span style="color: blue;">as</span> <span style="color:teal">MinRNR</span><span style="color: gray;">,</span></span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"><span style="color: teal;"> </span></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"><span style="color: teal;"> </span></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"><span style="color: fuchsia;">count</span><span style="color:gray">(*)</span> <span style="color: blue;">over </span><span style="color:gray">(</span><span style="color: blue;">partition</span> <span style="color:blue">by</span> 1<span style="color: gray;">)</span> <span style="color:blue">as</span> <span style="color: teal;">MaxRNR</span></span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"><span style="color: teal;"> </span></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"><span style="color: blue;">from</span> <span style="color:teal">#test</span></span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: gray;" lang="EN-US">),</span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: teal;" lang="EN-US">zeilenweise</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"> <span style="color: blue;">as</span></span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: gray;" lang="EN-US">(</span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"><span style="color: teal;"> </span></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"><span style="color: blue;">select</span></span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"><span style="color: teal;"> </span></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"><span style="color: teal;"> </span></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"><span style="color: teal;">RNR</span><span style="color:gray">,</span></span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"> </span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"><span style="color: teal;"> </span></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"><span style="color: teal;"> </span></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: teal;">ID</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: gray;">,</span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"><span style="color: teal;"> </span></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"><span style="color: teal;"> </span></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span style="color: teal;">Betrag</span><span style="color:gray">,</span></span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"><span style="color: teal;"> </span></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"><span style="color: teal;"> </span></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span style="color: teal;">Betrag</span> <span style="color:blue">as</span> <span style="color: teal;">Summe</span><span style="color:gray">,</span></span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"><span style="color: teal;"> </span></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"><span style="color: teal;"> </span></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span style="color: teal;">MinRNR</span><span style="color:gray">,</span></span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"><span style="color: teal;"> </span></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"><span style="color: teal;"> </span></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: teal;" lang="EN-US">MaxRNR</span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"><span style="color: teal;"> </span></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"><span style="color: blue;">from</span> <span style="color:teal">posten</span></span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"><span style="color: teal;"> </span></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"><span style="color: blue;">where</span></span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"><span style="color: teal;"> </span></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"><span style="color: teal;"> </span></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"><span style="color: teal;">RNR</span> <span style="color:gray">=</span> <span style="color: teal;">MinRNR</span></span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"> </span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"> </p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"><span style="color: teal;"> </span></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"><span style="color: blue;">union</span> <span style="color:gray">all</span></span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"> </span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"> </p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"><span style="color: teal;"> </span></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"><span style="color: blue;">select</span> </span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"><span style="color: teal;"> </span></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"><span style="color: teal;"> </span></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"><span style="color: teal;">z</span><span style="color:gray">.</span><span style="color: teal;">RNR</span> <span style="color:gray">+</span> 1<span style="color: gray;">,</span></span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"><span style="color: teal;"> </span></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"><span style="color: teal;"> </span></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"> </span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: teal;">p</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: gray;">.</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: teal;">ID</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: gray;">,</span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"><span style="color: teal;"> </span></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"><span style="color: teal;"> </span></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span style="color: teal;">p</span><span style="color:gray">.</span><span style="color: teal;">Betrag</span><span style="color:gray">,</span></span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"><span style="color: teal;"> </span></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"><span style="color: teal;"> </span></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span style="color: teal;">z</span><span style="color:gray">.</span><span style="color: teal;">Summe</span> <span style="color:gray">+</span> <span style="color: teal;">p</span><span style="color:gray">.</span><span style="color: teal;">Betrag</span><span style="color:gray">,</span></span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"><span style="color: teal;"> </span></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"><span style="color: teal;"> </span></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span style="color: teal;">z</span><span style="color:gray">.</span><span style="color: teal;">MinRNR</span><span style="color:gray">,</span></span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"><span style="color: teal;"> </span></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"><span style="color: teal;"> </span></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span style="color: teal;">z</span><span style="color:gray">.</span><span style="color: teal;">MaxRNR</span></span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"><span style="color: teal;"> </span></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span style="color:blue">from</span> <span style="color:teal">zeilenweise</span> <span style="color:teal">z</span></span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"><span style="color: teal;"> </span></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: gray;" lang="EN-US">inner</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"> <span style="color: gray;">join</span> <span style="color:teal">posten</span> <span style="color: teal;">p</span></span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"><span style="color: teal;"> </span></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"><span style="color: blue;">on</span></span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"><span style="color: teal;"> </span></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"><span style="color: teal;"> </span></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"><span style="color: teal;">p</span><span style="color:gray">.</span><span style="color: teal;">RNR</span> <span style="color:gray">=</span> <span style="color: teal;">z</span><span style="color:gray">.</span><span style="color: teal;">RNR</span> <span style="color:gray">+</span> 1</span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"><span style="color: teal;"> </span></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"><span style="color: blue;">where</span></span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"><span style="color: teal;"> </span></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"><span style="color: teal;"> </span></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"><span style="color: teal;">z</span><span style="color:gray">.</span><span style="color: teal;">RNR</span> <span style="color:gray">&lt;</span> <span style="color: teal;">z</span><span style="color:gray">.</span><span style="color: teal;">MaxRNR</span></span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: gray;" lang="EN-US">)</span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;" lang="EN-US">select</span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"><span style="color: teal;"> </span></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"><span style="color: teal;">ID</span><span style="color:gray">,</span></span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"><span style="color: teal;"> </span></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"> </span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: teal;">Betrag</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: gray;">,</span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"><span style="color: teal;"> </span></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span style="color:teal">Summe</span></span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">from</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"> <span style="color:teal">zeilenweise</span></span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt;text-autospace:none"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">option </span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: gray;">(</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: teal;">maxrecursion</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"> 0<span style="color:gray">)</span></span></p>
<p class="MsoNormal">Die Ausführungsgeschwindigkeit ist bis ca. 100.000 Datensätze durchaus annehmbar...</p>
<p class="MsoNormal">Viele Grüße</p>
<p class="MsoNormal">Christoph Ingenhaag</p>
</div>]]></content:encoded>
								<comments>https://www.insidesql.org/blogs/christoph_ingenhaag/2011/02/28/fortlaufende-summe#comments</comments>
			<wfw:commentRss>https://www.insidesql.org/blogs/christoph_ingenhaag/?tempskin=_rss2&#38;disp=comments&#38;p=2712</wfw:commentRss>
		</item>
				<item>
			<title>Table Value Parameters (TVP) und kein passendes Client API. Was nun?</title>
			<link>https://www.insidesql.org/blogs/christoph_ingenhaag/2010/09/03/table-value-parameters-tvp-und-kein-passendes-client-api-was-nun</link>
			<pubDate>Fri, 03 Sep 2010 19:49:14 +0000</pubDate>			<dc:creator>Christoph Ingenhaag</dc:creator>
			<category domain="main">TSQL</category>			<guid isPermaLink="false">1279@https://www.insidesql.org/blogs/</guid>
						<description>&lt;p&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;;&quot;&gt;Grundsätzlich sind in den Artikel von Erland Sommarskog  die Vorgehensweisen beschrieben:&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-size: 11pt; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;a href=&quot;http://www.sommarskog.se/arrays-in-sql-2008.html#Workarounds&quot;&gt;http://www.sommarskog.se/arrays-in-sql-2008.html#Workarounds&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;;&quot;&gt;&lt;a href=&quot;http://www.sommarskog.se/arrays-in-sql-2005.html#fixed-length&quot;&gt;http://www.sommarskog.se/arrays-in-sql-2005.html#fixed-length&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;;&quot;&gt;Aber es wird dort nur beispielhaft auf eine Liste von ganzen Zahlen eingegangen. &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;;&quot;&gt;Hier im Beispiel aber von ganzen Datensätzen. &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;;&quot;&gt;Im nachfolgenden Beispiel wird nur ein TVP verwandt.&lt;/span&gt; &lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;;&quot;&gt;Ziel im Beispiel ist es, Personendatensätze in eine Tabelle zu schreiben. Damit es nicht allzu langweilig ist, sollen vorhandene Sätze geändert und nicht vorhandene Sätze eingefügt werden.Das wird mittels MERGE und dem übergebenen TVP in einer Stored Procedure &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;;&quot;&gt;realisiert&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;;&quot;&gt;, für die eine weitere Stored Procedure als Wrapper verwendet wird, in der wiederum eine Funktion aufgerufen wird, die den BLOB als Parameter erhält und daraus den TVP zurück gibt, der dann an die aufzurufende Stored Procedure weitergegeben wird.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;;&quot;&gt;Achtung, man benötigt man die Numbers Funktion von Steve Kass:&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;;&quot;&gt; &lt;a href=&quot;http://stevekass.com/2006/06/03/how-to-generate-a-sequence-on-the-fly/&quot;&gt;http://stevekass.com/2006/06/03/how-to-generate-a-sequence-on-the-fly/&lt;/a&gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;;&quot;&gt;bzw. eine Numbers Tabelle (siehe z.B. &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;;&quot;&gt;&lt;a href=&quot;http://www.glorf.it/blog/2010/08/17/sql-talk/number-helper-table&quot;&gt;http://www.glorf.it/blog/2010/08/17/sql-talk/number-helper-table&lt;/a&gt; )&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-size: 11pt; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;;&quot;&gt; &lt;/span&gt; &lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;;&quot;&gt;Nun zu erst einmal die Tabelle und den passenden TVP erzeugen:&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: blue;&quot; lang=&quot;EN-US&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: fuchsia;&quot;&gt;object_id&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;&#039;dbo.Persons&#039;&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: gray;&quot;&gt;is&lt;/span&gt; &lt;span style=&quot;color: gray;&quot;&gt;not&lt;/span&gt; &lt;span style=&quot;color: gray;&quot;&gt;NULL&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;drop&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;table&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;dbo&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;Persons&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: blue;&quot; lang=&quot;EN-US&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: fuchsia;&quot;&gt;object_id&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;&#039;dbo.tvpTest&#039;&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: gray;&quot;&gt;is&lt;/span&gt; &lt;span style=&quot;color: gray;&quot;&gt;not&lt;/span&gt; &lt;span style=&quot;color: gray;&quot;&gt;NULL&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;drop&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;procedure&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;dbo&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;tvpTest&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: blue;&quot; lang=&quot;EN-US&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: fuchsia;&quot;&gt;object_id&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;&#039;dbo.fn_get_tvpPerson&#039;&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: gray;&quot;&gt;is&lt;/span&gt; &lt;span style=&quot;color: gray;&quot;&gt;not&lt;/span&gt; &lt;span style=&quot;color: gray;&quot;&gt;NULL&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;drop&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;function dbo&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;fn_get_tvpPerson&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: blue;&quot; lang=&quot;EN-US&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: fuchsia;&quot;&gt;object_id&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;&#039;dbo.tvpTestWrapper&#039;&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: gray;&quot;&gt;is&lt;/span&gt; &lt;span style=&quot;color: gray;&quot;&gt;not&lt;/span&gt; &lt;span style=&quot;color: gray;&quot;&gt;NULL&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;drop&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;procedure&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;dbo&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;tvpTestWrapper&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: blue;&quot; lang=&quot;EN-US&quot;&gt;begin&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;try&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;drop&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;type&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;dbo&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;tvpPersons&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;end&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;try&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;begin&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;catch&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;end&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;catch&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; color: blue;&quot; lang=&quot;EN-US&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: blue;&quot; lang=&quot;EN-US&quot;&gt;go&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: blue;&quot; lang=&quot;EN-US&quot;&gt;create&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;table&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;dbo&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;Persons&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: gray;&quot; lang=&quot;EN-US&quot;&gt;(&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 30px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: teal;&quot;&gt;ID&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;primary&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;key&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;clustered&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 30px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt;Vorname&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;nvarchar&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;(&lt;/span&gt;30&lt;span style=&quot;color: gray;&quot;&gt;),&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 30px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt;Name&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;nvarchar&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;(&lt;/span&gt;30&lt;span style=&quot;color: gray;&quot;&gt;),&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 30px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt;GebDat&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;datetime&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: gray;&quot; lang=&quot;EN-US&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: blue;&quot; lang=&quot;EN-US&quot;&gt;go&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; color: blue;&quot; lang=&quot;EN-US&quot;&gt; &lt;/span&gt;&lt;span style=&quot;font-size: 10pt; color: blue;&quot; lang=&quot;EN-US&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: blue;&quot; lang=&quot;EN-US&quot;&gt;create&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;type&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;dbo&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;tvpPersons&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;as&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;table&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: gray;&quot; lang=&quot;EN-US&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 30px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt;ID&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;primary&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;key&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;clustered&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 30px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;/span&gt;&lt;span style=&quot;font-size: 10pt; color: teal;&quot;&gt;Vorname&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;nvarchar&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;(&lt;/span&gt;30&lt;span style=&quot;color: gray;&quot;&gt;),&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 30px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt; &lt;span style=&quot;color: teal;&quot;&gt;Name&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;nvarchar&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;(&lt;/span&gt;30&lt;span style=&quot;color: gray;&quot;&gt;),&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 30px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt; &lt;span style=&quot;color: teal;&quot;&gt;GebDat&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;datetime&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: gray;&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: blue;&quot;&gt;go&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;;&quot;&gt;Die Frage, ob ein TVP einen Primary Key benötigt und ggf. sogar &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;unique constraints&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;;&quot;&gt;, muss man anhand des Verwendungszweckes klären. &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;;&quot;&gt;Hier im Beispiel sollen Datensätze bei Vorhandensein aktualisiert werden, sonst eingefügt werden. Nachfolgend&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt; die &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;;&quot;&gt;entsprechende&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt; Stored Procedure:&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: blue;&quot; lang=&quot;EN-US&quot;&gt;create&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;proc&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;dbo&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;tvpTest&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 30px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt;@tvp&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;as&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;dbo&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;tvpPersons&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;readonly&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: blue;&quot; lang=&quot;EN-US&quot;&gt;as&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: blue;&quot; lang=&quot;EN-US&quot;&gt;set&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;nocount&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;on&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: blue;&quot; lang=&quot;EN-US&quot;&gt;set&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;xact_abort&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;on&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 30px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: blue;&quot; lang=&quot;EN-US&quot;&gt; &lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;merge&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;into&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;dbo&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;Persons&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;t&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 30px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;using&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@tvp&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;s&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 30px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;on&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: teal;&quot;&gt;s&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;ID&lt;/span&gt; &lt;span style=&quot;color: gray;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;t&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;ID&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 30px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: teal;&quot; lang=&quot;EN-US&quot;&gt; &lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;when&lt;/span&gt; &lt;span style=&quot;color: gray;&quot;&gt;matched&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;then&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 30px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: blue;&quot; lang=&quot;EN-US&quot;&gt; &lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;update&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;set&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 60px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: teal;&quot;&gt;t&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;ID&lt;/span&gt; &lt;span style=&quot;color: gray;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;s&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;ID&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 60px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: teal;&quot;&gt;t&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;Vorname&lt;/span&gt; &lt;span style=&quot;color: gray;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;s&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;Vorname&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 60px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: teal;&quot;&gt;t&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;Name&lt;/span&gt; &lt;span style=&quot;color: gray;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;s&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;Name&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 60px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt;t&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;GebDat&lt;/span&gt; &lt;span style=&quot;color: gray;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;s&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;GebDat&lt;/span&gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 30px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;when&lt;/span&gt; &lt;span style=&quot;color: gray;&quot;&gt;not&lt;/span&gt; &lt;span style=&quot;color: gray;&quot;&gt;matched&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;then&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; color: blue;&quot; lang=&quot;EN-US&quot;&gt; &lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 30px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;insert&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; color: blue;&quot; lang=&quot;EN-US&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 30px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: gray;&quot; lang=&quot;EN-US&quot;&gt;(&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 60px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: teal;&quot;&gt;ID&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 60px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt;Vorname&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 60px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: teal;&quot;&gt;Name&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 60px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: teal;&quot;&gt;GebDat&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 30px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: gray;&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 30px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;values&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 30px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: blue;&quot; lang=&quot;EN-US&quot;&gt; &lt;/span&gt;&lt;span style=&quot;font-size: 10pt; color: gray;&quot; lang=&quot;EN-US&quot;&gt;(&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 60px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: teal;&quot;&gt;s&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;ID&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 60px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt;s&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;Vorname&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 60px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt;s&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;Name&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 60px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt;s&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;GebDat&lt;/span&gt; &lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 30px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: gray;&quot;&gt;);&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: blue;&quot;&gt;go&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 11pt; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;br /&gt;&lt;/span&gt; &lt;!--[if !supportLineBreakNewLine]--&gt;&lt;br /&gt; &lt;!--[endif]--&gt;&lt;/span&gt; &lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;;&quot;&gt;da die Client API nicht mit TVPs umgehen kann, nun die Wrapper Prozedur, die knapp gehalten ist, da die Funktionalität in der aufzurufenden Funktion liegt (der Parameter @p ist hier als output definiert um sich im SQL Server Profiler den Inhalt des Parameters als Textdata anschauen zu können)&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;;&quot;&gt; &lt;/span&gt; &lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: blue;&quot; lang=&quot;EN-US&quot;&gt;create&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;proc&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;dbo&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;tvpTestWrapper&lt;/span&gt;&lt;/span&gt; &lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 30px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt;@p &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;varbinary&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: fuchsia;&quot;&gt;max&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;output&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: blue;&quot; lang=&quot;EN-US&quot;&gt;as&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: blue;&quot; lang=&quot;EN-US&quot;&gt;set&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;nocount&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;on&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: blue;&quot; lang=&quot;EN-US&quot;&gt;set&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;xact_abort&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;on&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 30px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;declare&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@tvp&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;as&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;dbo&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;tvpPersons&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 30px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: teal;&quot; lang=&quot;EN-US&quot;&gt; &lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;insert&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;into&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@tvp&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 30px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;select&lt;/span&gt; &lt;span style=&quot;color: gray;&quot;&gt;*&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;from&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;dbo&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;fn_get_tvpPerson&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;@p&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 30px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: gray;&quot; lang=&quot;EN-US&quot;&gt; &lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;/span&gt;&lt;span style=&quot;font-size: 10pt; color: blue;&quot;&gt;exec&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt; &lt;span style=&quot;color: teal;&quot;&gt;dbo&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;tvpTest&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;@tvp&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: teal;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;font-size: 10pt; color: blue;&quot;&gt;go&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;;&quot;&gt;Die Funktion hat die Aufgabe, den BLOB in die entsprechenden Häppchen zu schneiden und in die entsprechenden Datentypen zu konvertieren. Was der Client da binär anliefert, lässt sich nicht immer einfach von binary zu dem gewünschten Datentypen konvertieren. Hier im Beispiel muss die Byte Reihenfolge beim INT umgedreht werden und das Datum als String übertragen werden. Natürlich könnte man alles als String übertragen, würde damit aber auch entsprechend mehr Bandbreite benötigen. &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;;&quot;&gt;Da bekannt ist, wie viele Bytes ein Datensatz im BLOB hat, ist mit Hilfe der Numbers Funktion das Teilen in einzelne Sätze kein Problem.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: blue;&quot; lang=&quot;EN-US&quot;&gt;create&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;function&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;dbo&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;fn_get_tvpPerson&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: gray;&quot; lang=&quot;EN-US&quot;&gt;(&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 30px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: teal;&quot;&gt;@p&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;varbinary&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: fuchsia;&quot;&gt;max&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: gray;&quot; lang=&quot;EN-US&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: blue;&quot; lang=&quot;EN-US&quot;&gt;returns&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: teal;&quot;&gt;@tvp&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;table&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: gray;&quot; lang=&quot;EN-US&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 30px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt;ID&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;primary&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;key&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;clustered&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 30px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: teal;&quot;&gt;Vorname&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;nvarchar&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;(&lt;/span&gt;30&lt;span style=&quot;color: gray;&quot;&gt;),&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 30px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: teal;&quot;&gt;Name&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;nvarchar&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;(&lt;/span&gt;30&lt;span style=&quot;color: gray;&quot;&gt;),&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 30px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: teal;&quot;&gt;GebDat&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;datetime&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: gray;&quot; lang=&quot;EN-US&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: blue;&quot; lang=&quot;EN-US&quot;&gt;as&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: blue;&quot; lang=&quot;EN-US&quot;&gt; &lt;/span&gt;&lt;span style=&quot;font-size: 10pt; color: blue;&quot; lang=&quot;EN-US&quot;&gt;begin&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 30px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: fuchsia;&quot;&gt;datalength&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;@p&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: gray;&quot;&gt;%&lt;/span&gt; 140 &lt;span style=&quot;color: gray;&quot;&gt;=&lt;/span&gt; 0&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 30px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;begin&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 60px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: blue;&quot; lang=&quot;EN-US&quot;&gt; &lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;insert&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;into&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@tvp&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 60px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;select&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 90px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: fuchsia;&quot;&gt;convert&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; color: blue;&quot; lang=&quot;EN-US&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 90px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: gray;&quot; lang=&quot;EN-US&quot;&gt;(&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 120px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 120px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: fuchsia;&quot;&gt;substring&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;@p&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt; 4 &lt;span style=&quot;color: gray;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;n&lt;/span&gt; &lt;span style=&quot;color: gray;&quot;&gt;-&lt;/span&gt;1&lt;span style=&quot;color: gray;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: gray;&quot;&gt;*&lt;/span&gt; 140&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt; 1&lt;span style=&quot;color: gray;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: gray;&quot;&gt;+&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 120px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;/span&gt;&lt;span style=&quot;font-size: 10pt; color: fuchsia;&quot;&gt;substring&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; color: gray;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; color: teal;&quot;&gt;@p&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; color: gray;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt; 3 &lt;span style=&quot;color: gray;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;n&lt;/span&gt; &lt;span style=&quot;color: gray;&quot;&gt;-&lt;/span&gt;1&lt;span style=&quot;color: gray;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: gray;&quot;&gt;*&lt;/span&gt; 140&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt; 1&lt;span style=&quot;color: gray;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: gray;&quot;&gt;+&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 120px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt;&lt;span style=&quot;color: fuchsia;&quot;&gt;substring&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;@p&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt; 2 &lt;span style=&quot;color: gray;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;n&lt;/span&gt; &lt;span style=&quot;color: gray;&quot;&gt;-&lt;/span&gt;1&lt;span style=&quot;color: gray;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: gray;&quot;&gt;*&lt;/span&gt; 140&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt; 1&lt;span style=&quot;color: gray;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: gray;&quot;&gt;+&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 120px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;font-size: 10pt; color: fuchsia;&quot; lang=&quot;EN-US&quot;&gt;substring&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; color: gray;&quot; lang=&quot;EN-US&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; color: teal;&quot; lang=&quot;EN-US&quot;&gt;@p&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; color: gray;&quot; lang=&quot;EN-US&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; 1 &lt;span style=&quot;color: gray;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;n&lt;/span&gt; &lt;span style=&quot;color: gray;&quot;&gt;-&lt;/span&gt;1&lt;span style=&quot;color: gray;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: gray;&quot;&gt;*&lt;/span&gt; 140&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt; 1&lt;span style=&quot;color: gray;&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 90px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: gray;&quot;&gt;),&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 90px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: fuchsia;&quot;&gt;convert&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;nvarchar&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;(&lt;/span&gt;30&lt;span style=&quot;color: gray;&quot;&gt;),&lt;/span&gt; &lt;span style=&quot;color: fuchsia;&quot;&gt;substring&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;@p&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt; 5 &lt;span style=&quot;color: gray;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;n&lt;/span&gt; &lt;span style=&quot;color: gray;&quot;&gt;-&lt;/span&gt;1&lt;span style=&quot;color: gray;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: gray;&quot;&gt;*&lt;/span&gt; 140&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt; 60&lt;span style=&quot;color: gray;&quot;&gt;)),&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 90px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: fuchsia;&quot;&gt;convert&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;nvarchar&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;(&lt;/span&gt;30&lt;span style=&quot;color: gray;&quot;&gt;),&lt;/span&gt; &lt;span style=&quot;color: fuchsia;&quot;&gt;substring&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;@p&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt; 65 &lt;span style=&quot;color: gray;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;n&lt;/span&gt; &lt;span style=&quot;color: gray;&quot;&gt;-&lt;/span&gt;1&lt;span style=&quot;color: gray;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: gray;&quot;&gt;*&lt;/span&gt; 140&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt; 60&lt;span style=&quot;color: gray;&quot;&gt;)),&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 90px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: fuchsia;&quot;&gt;convert&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;nvarchar&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;(&lt;/span&gt;16&lt;span style=&quot;color: gray;&quot;&gt;),&lt;/span&gt; &lt;span style=&quot;color: fuchsia;&quot;&gt;substring&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;@p&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt; 125 &lt;span style=&quot;color: gray;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;n&lt;/span&gt; &lt;span style=&quot;color: gray;&quot;&gt;-&lt;/span&gt;1&lt;span style=&quot;color: gray;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: gray;&quot;&gt;*&lt;/span&gt; 140&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt; 16&lt;span style=&quot;color: gray;&quot;&gt;))&lt;/span&gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 60px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;from&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;dbo&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;Numbers&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;(&lt;/span&gt;1&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: fuchsia;&quot;&gt;datalength&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;@p&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;)/&lt;/span&gt;140&lt;span style=&quot;color: gray;&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 30px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: gray;&quot; lang=&quot;EN-US&quot;&gt; &lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;end&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 30px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;return&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; color: blue;&quot; lang=&quot;EN-US&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: blue;&quot; lang=&quot;EN-US&quot;&gt;end&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;&quot; lang=&quot;EN-US&quot;&gt; &lt;/span&gt; &lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;;&quot;&gt;Als Test-Client fungiert hier VBA mit ADO 2.8.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;;&quot;&gt; Nachfolgend&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt; die Klasse TVP4ADO28&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt; &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;br /&gt;Private adoStream As ADODB.stream&lt;br /&gt;&lt;br /&gt;Private Type typRecord&lt;br /&gt; ID As Long              &#039;4 Byte&lt;br /&gt; Vorname As String * 30  &#039;60 Byte&lt;br /&gt; Name As String * 30     &#039;60 Byte&lt;br /&gt; GebDat As String * 8    &#039;16 Byte&lt;br /&gt;End Type&lt;br /&gt;&lt;br /&gt;Private Type typBinRecord&lt;br /&gt; record(1 To 140) As Byte&lt;br /&gt;End Type&lt;br /&gt;&lt;br /&gt;Private Sub Class_Initialize()&lt;br /&gt; &lt;br /&gt; Set adoStream = New ADODB.stream&lt;br /&gt; adoStream.Type = adTypeBinary&lt;br /&gt; adoStream.Mode = adModeReadWrite&lt;br /&gt; adoStream.Open&lt;br /&gt;&lt;br /&gt;End Sub&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Public Sub AddRecord(ID As Long, Vorname As String, Name As String, GebDat As Date)&lt;br /&gt;&lt;br /&gt; Dim t As typRecord&lt;br /&gt; Dim r As typBinRecord&lt;br /&gt; Dim s() As String&lt;br /&gt; &lt;br /&gt; s() = Split(CStr(GebDat), &quot;.&quot;)&lt;br /&gt; &lt;br /&gt; t.ID = ID&lt;br /&gt; t.Vorname = Vorname&lt;br /&gt; t.Name = Name&lt;br /&gt; t.GebDat = s(2) &amp;amp; s(1) &amp;amp; s(0)&lt;br /&gt;&lt;br /&gt; LSet r = t&lt;br /&gt; &lt;br /&gt; adoStream.Write r.record&lt;br /&gt; &lt;br /&gt;End Sub&lt;br /&gt;&lt;br /&gt;Public Property Get GetStream() As ADODB.stream&lt;br /&gt;&lt;br /&gt; adoStream.Position = 0&lt;br /&gt; Set GetStream = adoStream&lt;br /&gt;&lt;br /&gt;End Property&lt;br /&gt;&lt;br /&gt;Private Sub Class_Terminate()&lt;br /&gt;&lt;br /&gt; adoStream.Close&lt;br /&gt; Set adoStream = Nothing&lt;br /&gt;&lt;br /&gt;End Sub&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;und hier der Aufruf (&lt;/span&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;;&quot;&gt;Der Application Name im Connection String dient zum einfachen Filtern im SQL Server Profiler)&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;Public Sub Test()&lt;br /&gt;&lt;br /&gt; Dim conn As New ADODB.Connection&lt;br /&gt; Dim com As New ADODB.Command&lt;br /&gt; Dim i As Long&lt;br /&gt; &lt;br /&gt; Set tvp = New TVP4ADO28&lt;br /&gt; &lt;br /&gt; For i = 1 To 10000&lt;br /&gt;&lt;br /&gt; tvp.AddRecord i, &quot;Klaus&quot;, &quot;Müller&quot;, &quot;09.06.1957&quot;&lt;br /&gt;&lt;br /&gt; Next i&lt;br /&gt;&lt;br /&gt;&lt;br /&gt; With conn&lt;br /&gt;&lt;br /&gt; .ConnectionString = _&lt;br /&gt; &quot;Provider=SQLNCLI10;&quot; &amp;amp; _&lt;br /&gt; &quot;Integrated Security=SSPI;&quot; &amp;amp; _&lt;br /&gt; &quot;Persist Security Info=True;&quot; &amp;amp; _&lt;br /&gt; &quot;Initial Catalog=Test;&quot; &amp;amp; _&lt;br /&gt; &quot;Data Source=MeinServer\MeineInstanz;&quot; &amp;amp; _&lt;br /&gt; &quot;Application Name=MeineApplikation&quot;&lt;br /&gt;&lt;br /&gt; .CursorLocation = adUseClient&lt;br /&gt; .IsolationLevel = adXactReadCommitted&lt;br /&gt; .Mode = adModeReadWrite&lt;br /&gt;&lt;br /&gt; .Open&lt;br /&gt;&lt;br /&gt; End With&lt;br /&gt;&lt;br /&gt; With com&lt;br /&gt;&lt;br /&gt; .CommandType = adCmdStoredProc&lt;br /&gt; .CommandText = &quot;dbo.tvpTestWrapper&quot;&lt;br /&gt; .ActiveConnection = conn&lt;br /&gt; .NamedParameters = False&lt;br /&gt;&lt;br /&gt;.Parameters.Append .CreateParameter(&quot;@p&quot;, adVarBinary, adParamInputOutput, _&lt;br /&gt; tvp.GetStream.Size, tvp.GetStream.Read)&lt;br /&gt;&lt;br /&gt; Dim t As Single&lt;br /&gt; &lt;br /&gt; t = Timer&lt;br /&gt; &lt;br /&gt; .Execute Options:=adExecuteNoRecords&lt;br /&gt;&lt;br /&gt; t = Timer - t&lt;br /&gt; &lt;br /&gt; End With&lt;br /&gt;&lt;br /&gt; Debug.Print t&lt;br /&gt;&lt;br /&gt; conn.Close&lt;br /&gt; &lt;br /&gt; Set com = Nothing&lt;br /&gt; Set conn = Nothing&lt;br /&gt; Set tvp = Nothing&lt;br /&gt;&lt;br /&gt;End Sub&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;Viele Grüße&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;Christoph Ingenhaag&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;</description>
			<content:encoded><![CDATA[<p><span style="font-size: small;"><span style="font-family: &quot;Arial&quot;,&quot;sans-serif&quot;;">Grundsätzlich sind in den Artikel von Erland Sommarskog  die Vorgehensweisen beschrieben:</span></span></p>
<p><span style="font-size: 11pt; font-family: &quot;Arial&quot;,&quot;sans-serif&quot;;"><span style="font-size: small;"><a href="http://www.sommarskog.se/arrays-in-sql-2008.html#Workarounds">http://www.sommarskog.se/arrays-in-sql-2008.html#Workarounds</a></span></span></p>
<p><span style="font-size: small;"><span style="font-family: &quot;Arial&quot;,&quot;sans-serif&quot;;"><a href="http://www.sommarskog.se/arrays-in-sql-2005.html#fixed-length">http://www.sommarskog.se/arrays-in-sql-2005.html#fixed-length</a></span></span></p>
<p><span style="font-size: small;"><span style="font-family: &quot;Arial&quot;,&quot;sans-serif&quot;;">Aber es wird dort nur beispielhaft auf eine Liste von ganzen Zahlen eingegangen. </span></span><span style="font-size: small;"><span style="font-family: &quot;Arial&quot;,&quot;sans-serif&quot;;">Hier im Beispiel aber von ganzen Datensätzen. </span></span></p>
<p><span style="font-size: small;"><span style="font-family: &quot;Arial&quot;,&quot;sans-serif&quot;;">Im nachfolgenden Beispiel wird nur ein TVP verwandt.</span> <span style="font-family: &quot;Arial&quot;,&quot;sans-serif&quot;;">Ziel im Beispiel ist es, Personendatensätze in eine Tabelle zu schreiben. Damit es nicht allzu langweilig ist, sollen vorhandene Sätze geändert und nicht vorhandene Sätze eingefügt werden.Das wird mittels MERGE und dem übergebenen TVP in einer Stored Procedure </span><span style="font-family: &quot;Arial&quot;,&quot;sans-serif&quot;;">realisiert</span><span style="font-family: &quot;Arial&quot;,&quot;sans-serif&quot;;">, für die eine weitere Stored Procedure als Wrapper verwendet wird, in der wiederum eine Funktion aufgerufen wird, die den BLOB als Parameter erhält und daraus den TVP zurück gibt, der dann an die aufzurufende Stored Procedure weitergegeben wird.</span></span></p>
<p><span style="font-size: small;"><span style="font-family: &quot;Arial&quot;,&quot;sans-serif&quot;;">Achtung, man benötigt man die Numbers Funktion von Steve Kass:</span></span></p>
<p><span style="font-size: small;"><span style="font-family: &quot;Arial&quot;,&quot;sans-serif&quot;;"> <a href="http://stevekass.com/2006/06/03/how-to-generate-a-sequence-on-the-fly/">http://stevekass.com/2006/06/03/how-to-generate-a-sequence-on-the-fly/</a> </span></span></p>
<p><span style="font-size: small;"><span style="font-family: &quot;Arial&quot;,&quot;sans-serif&quot;;">bzw. eine Numbers Tabelle (siehe z.B. </span><span style="font-family: &quot;Arial&quot;,&quot;sans-serif&quot;;"><a href="http://www.glorf.it/blog/2010/08/17/sql-talk/number-helper-table">http://www.glorf.it/blog/2010/08/17/sql-talk/number-helper-table</a> )</span></span></p>
<p><span style="font-family: &quot;Arial&quot;,&quot;sans-serif&quot;;"><br /></span></p>
<p><span style="font-size: 11pt; font-family: &quot;Arial&quot;,&quot;sans-serif&quot;;"> </span> <span style="font-size: small;"><span style="font-family: &quot;Arial&quot;,&quot;sans-serif&quot;;">Nun zu erst einmal die Tabelle und den passenden TVP erzeugen:</span></span></p>
<p><span style="font-family: courier new,courier;"><span style="font-size: 10pt; color: blue;" lang="EN-US">if</span><span style="font-size: 10pt;" lang="EN-US"> <span style="color: fuchsia;">object_id</span><span style="color: gray;">(</span><span style="color: red;">'dbo.Persons'</span><span style="color: gray;">)</span> <span style="color: gray;">is</span> <span style="color: gray;">not</span> <span style="color: gray;">NULL</span> <span style="color: blue;">drop</span> <span style="color: blue;">table</span> <span style="color: teal;">dbo</span><span style="color: gray;">.</span><span style="color: teal;">Persons</span></span></span></p>
<p><span style="font-family: courier new,courier;"><span style="font-size: 10pt; color: blue;" lang="EN-US">if</span><span style="font-size: 10pt;" lang="EN-US"> <span style="color: fuchsia;">object_id</span><span style="color: gray;">(</span><span style="color: red;">'dbo.tvpTest'</span><span style="color: gray;">)</span> <span style="color: gray;">is</span> <span style="color: gray;">not</span> <span style="color: gray;">NULL</span> <span style="color: blue;">drop</span> <span style="color: blue;">procedure</span> <span style="color: teal;">dbo</span><span style="color: gray;">.</span><span style="color: teal;">tvpTest</span></span></span></p>
<p><span style="font-family: courier new,courier;"><span style="font-size: 10pt; color: blue;" lang="EN-US">if</span><span style="font-size: 10pt;" lang="EN-US"> <span style="color: fuchsia;">object_id</span><span style="color: gray;">(</span><span style="color: red;">'dbo.fn_get_tvpPerson'</span><span style="color: gray;">)</span> <span style="color: gray;">is</span> <span style="color: gray;">not</span> <span style="color: gray;">NULL</span> <span style="color: blue;">drop</span> <span style="color: teal;">function dbo</span><span style="color: gray;">.</span><span style="color: teal;">fn_get_tvpPerson</span></span></span></p>
<p><span style="font-family: courier new,courier;"><span style="font-size: 10pt; color: blue;" lang="EN-US">if</span><span style="font-size: 10pt;" lang="EN-US"> <span style="color: fuchsia;">object_id</span><span style="color: gray;">(</span><span style="color: red;">'dbo.tvpTestWrapper'</span><span style="color: gray;">)</span> <span style="color: gray;">is</span> <span style="color: gray;">not</span> <span style="color: gray;">NULL</span> <span style="color: blue;">drop</span> <span style="color: blue;">procedure</span> <span style="color: teal;">dbo</span><span style="color: gray;">.</span><span style="color: teal;">tvpTestWrapper</span></span></span></p>
<p><span style="font-family: courier new,courier;"><span style="font-size: 10pt; color: blue;" lang="EN-US">begin</span><span style="font-size: 10pt;" lang="EN-US"> <span style="color: blue;">try</span> <span style="color: blue;">drop</span> <span style="color: blue;">type</span> <span style="color: teal;">dbo</span><span style="color: gray;">.</span><span style="color: teal;">tvpPersons</span> <span style="color: blue;">end</span> <span style="color: blue;">try</span> <span style="color: blue;">begin</span> <span style="color: blue;">catch</span> <span style="color: blue;">end</span> <span style="color: blue;">catch</span></span><span style="font-size: 10pt; color: blue;" lang="EN-US"> </span></span></p>
<p><span style="font-family: courier new,courier;"><span style="font-size: 10pt; color: blue;" lang="EN-US">go</span><span style="font-size: 10pt;" lang="EN-US"> </span></span></p>
<p><span style="font-family: courier new,courier;"><span style="font-size: 10pt; color: blue;" lang="EN-US">create</span><span style="font-size: 10pt;" lang="EN-US"> <span style="color: blue;">table</span> <span style="color: teal;">dbo</span><span style="color: gray;">.</span><span style="color: teal;">Persons</span></span></span></p>
<p><span style="font-family: courier new,courier;"><span style="font-size: 10pt; color: gray;" lang="EN-US">(</span></span></p>
<p style="padding-left: 30px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt;" lang="EN-US"> <span style="color: teal;">ID</span> <span style="color: blue;">int</span> <span style="color: blue;">primary</span> <span style="color: blue;">key</span> <span style="color: blue;">clustered</span><span style="color: gray;">,</span></span><span style="font-size: 10pt;" lang="EN-US"> </span></span></p>
<p style="padding-left: 30px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt;" lang="EN-US"><span style="color: teal;">Vorname</span> <span style="color: blue;">nvarchar</span><span style="color: gray;">(</span>30<span style="color: gray;">),</span></span><span style="font-size: 10pt;" lang="EN-US"> </span></span></p>
<p style="padding-left: 30px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt;" lang="EN-US"><span style="color: teal;">Name</span> <span style="color: blue;">nvarchar</span><span style="color: gray;">(</span>30<span style="color: gray;">),</span></span><span style="font-size: 10pt;" lang="EN-US"> </span></span></p>
<p style="padding-left: 30px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt;" lang="EN-US"><span style="color: teal;">GebDat</span> <span style="color: blue;">datetime</span></span></span></p>
<p><span style="font-family: courier new,courier;"><span style="font-size: 10pt; color: gray;" lang="EN-US">)</span></span></p>
<p><span style="font-family: courier new,courier;"><span style="font-size: 10pt; color: blue;" lang="EN-US">go</span><span style="font-size: 10pt; color: blue;" lang="EN-US"> </span><span style="font-size: 10pt; color: blue;" lang="EN-US"> </span></span></p>
<p><span style="font-family: courier new,courier;"><span style="font-size: 10pt; color: blue;" lang="EN-US">create</span><span style="font-size: 10pt;" lang="EN-US"> <span style="color: blue;">type</span> <span style="color: teal;">dbo</span><span style="color: gray;">.</span><span style="color: teal;">tvpPersons</span> <span style="color: blue;">as</span> <span style="color: blue;">table</span></span></span></p>
<p><span style="font-family: courier new,courier;"><span style="font-size: 10pt; color: gray;" lang="EN-US">(</span><span style="font-size: 10pt;" lang="EN-US"> </span></span></p>
<p style="padding-left: 30px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt;" lang="EN-US"><span style="color: teal;">ID</span> <span style="color: blue;">int</span> <span style="color: blue;">primary</span> <span style="color: blue;">key</span> <span style="color: blue;">clustered</span><span style="color: gray;">,</span></span></span></p>
<p style="padding-left: 30px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt;" lang="EN-US"> </span><span style="font-size: 10pt; color: teal;">Vorname</span><span style="font-size: 10pt;"> <span style="color: blue;">nvarchar</span><span style="color: gray;">(</span>30<span style="color: gray;">),</span></span></span></p>
<p style="padding-left: 30px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt;"> <span style="color: teal;">Name</span> <span style="color: blue;">nvarchar</span><span style="color: gray;">(</span>30<span style="color: gray;">),</span></span></span></p>
<p style="padding-left: 30px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt;"> <span style="color: teal;">GebDat</span> <span style="color: blue;">datetime</span></span></span></p>
<p><span style="font-family: courier new,courier;"><span style="font-size: 10pt; color: gray;">)</span></span></p>
<p><span style="font-family: courier new,courier;"><span style="font-size: 10pt; color: blue;">go</span></span></p>
<p><span style="font-size: small;"><span style="font-family: &quot;Arial&quot;,&quot;sans-serif&quot;;">Die Frage, ob ein TVP einen Primary Key benötigt und ggf. sogar </span><span style="font-family: &quot;Arial&quot;,&quot;sans-serif&quot;;" lang="EN-US">unique constraints</span><span style="font-family: &quot;Arial&quot;,&quot;sans-serif&quot;;">, muss man anhand des Verwendungszweckes klären. </span><span style="font-family: &quot;Arial&quot;,&quot;sans-serif&quot;;">Hier im Beispiel sollen Datensätze bei Vorhandensein aktualisiert werden, sonst eingefügt werden. Nachfolgend</span><span style="font-family: &quot;Arial&quot;,&quot;sans-serif&quot;;" lang="EN-US"> die </span><span style="font-family: &quot;Arial&quot;,&quot;sans-serif&quot;;">entsprechende</span><span style="font-family: &quot;Arial&quot;,&quot;sans-serif&quot;;" lang="EN-US"> Stored Procedure:</span></span></p>
<p><span style="font-family: courier new,courier;"><span style="font-size: 10pt; color: blue;" lang="EN-US">create</span><span style="font-size: 10pt;" lang="EN-US"> <span style="color: blue;">proc</span> <span style="color: teal;">dbo</span><span style="color: gray;">.</span><span style="color: teal;">tvpTest</span></span><span style="font-size: 10pt;" lang="EN-US"> </span></span></p>
<p style="padding-left: 30px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt;" lang="EN-US"><span style="color: teal;">@tvp</span> <span style="color: blue;">as</span> <span style="color: teal;">dbo</span><span style="color: gray;">.</span><span style="color: teal;">tvpPersons</span> <span style="color: blue;">readonly</span></span></span></p>
<p><span style="font-family: courier new,courier;"><span style="font-size: 10pt; color: blue;" lang="EN-US">as</span></span></p>
<p><span style="font-family: courier new,courier;"><span style="font-size: 10pt; color: blue;" lang="EN-US">set</span><span style="font-size: 10pt;" lang="EN-US"> <span style="color: blue;">nocount</span> <span style="color: blue;">on</span></span></span></p>
<p><span style="font-family: courier new,courier;"><span style="font-size: 10pt; color: blue;" lang="EN-US">set</span><span style="font-size: 10pt;" lang="EN-US"> <span style="color: blue;">xact_abort</span> <span style="color: blue;">on</span></span></span></p>
<p><span style="font-family: courier new,courier;"><span style="font-size: 10pt;" lang="EN-US"><span style="color: blue;"><br /></span></span></span></p>
<p style="padding-left: 30px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt; color: blue;" lang="EN-US"> </span><span style="font-size: 10pt;" lang="EN-US"> <span style="color: blue;">merge</span> <span style="color: blue;">into</span> <span style="color: teal;">dbo</span><span style="color: gray;">.</span><span style="color: teal;">Persons</span> <span style="color: teal;">t</span></span></span></p>
<p style="padding-left: 30px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt;" lang="EN-US"> <span style="color: blue;">using</span> <span style="color: teal;">@tvp</span> <span style="color: teal;">s</span></span></span></p>
<p style="padding-left: 30px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt;" lang="EN-US"> <span style="color: blue;">on</span></span> <span style="font-size: 10pt;" lang="EN-US"> <span style="color: teal;">s</span><span style="color: gray;">.</span><span style="color: teal;">ID</span> <span style="color: gray;">=</span> <span style="color: teal;">t</span><span style="color: gray;">.</span><span style="color: teal;">ID</span></span></span></p>
<p style="padding-left: 30px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt; color: teal;" lang="EN-US"> </span><span style="font-size: 10pt;" lang="EN-US"> <span style="color: blue;">when</span> <span style="color: gray;">matched</span> <span style="color: blue;">then</span></span></span></p>
<p style="padding-left: 30px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt; color: blue;" lang="EN-US"> </span><span style="font-size: 10pt;" lang="EN-US"> <span style="color: blue;">update</span> <span style="color: blue;">set</span></span></span></p>
<p style="padding-left: 60px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt;" lang="EN-US"> <span style="color: teal;">t</span><span style="color: gray;">.</span><span style="color: teal;">ID</span> <span style="color: gray;">=</span> <span style="color: teal;">s</span><span style="color: gray;">.</span><span style="color: teal;">ID</span><span style="color: gray;">,</span> </span></span></p>
<p style="padding-left: 60px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt;" lang="EN-US"> <span style="color: teal;">t</span><span style="color: gray;">.</span><span style="color: teal;">Vorname</span> <span style="color: gray;">=</span> <span style="color: teal;">s</span><span style="color: gray;">.</span><span style="color: teal;">Vorname</span><span style="color: gray;">,</span></span></span></p>
<p style="padding-left: 60px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt;" lang="EN-US"> <span style="color: teal;">t</span><span style="color: gray;">.</span><span style="color: teal;">Name</span> <span style="color: gray;">=</span> <span style="color: teal;">s</span><span style="color: gray;">.</span><span style="color: teal;">Name</span><span style="color: gray;">,</span></span><span style="font-size: 10pt;" lang="EN-US"> </span></span></p>
<p style="padding-left: 60px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt;" lang="EN-US"><span style="color: teal;">t</span><span style="color: gray;">.</span><span style="color: teal;">GebDat</span> <span style="color: gray;">=</span> <span style="color: teal;">s</span><span style="color: gray;">.</span><span style="color: teal;">GebDat</span> </span></span></p>
<p style="padding-left: 30px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt;" lang="EN-US"> </span><span style="font-size: 10pt;" lang="EN-US"> </span><span style="font-size: 10pt;" lang="EN-US"> <span style="color: blue;">when</span> <span style="color: gray;">not</span> <span style="color: gray;">matched</span> <span style="color: blue;">then</span></span><span style="font-size: 10pt; color: blue;" lang="EN-US"> </span><span style="font-size: 10pt;" lang="EN-US"> </span></span></p>
<p style="padding-left: 30px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt;" lang="EN-US"><span style="color: blue;">insert</span></span><span style="font-size: 10pt; color: blue;" lang="EN-US"> </span></span></p>
<p style="padding-left: 30px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt; color: gray;" lang="EN-US">(</span></span></p>
<p style="padding-left: 60px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt;" lang="EN-US"> <span style="color: teal;">ID</span><span style="color: gray;">,</span></span><span style="font-size: 10pt;" lang="EN-US"> </span></span></p>
<p style="padding-left: 60px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt;" lang="EN-US"><span style="color: teal;">Vorname</span><span style="color: gray;">,</span></span></span></p>
<p style="padding-left: 60px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt;" lang="EN-US"> <span style="color: teal;">Name</span><span style="color: gray;">,</span></span></span></p>
<p style="padding-left: 60px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt;" lang="EN-US"> <span style="color: teal;">GebDat</span></span></span></p>
<p style="padding-left: 30px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt;" lang="EN-US"> <span style="color: gray;">)</span></span><span style="font-size: 10pt;" lang="EN-US"> </span></span></p>
<p style="padding-left: 30px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt;" lang="EN-US"><span style="color: blue;">values</span></span></span></p>
<p style="padding-left: 30px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt; color: blue;" lang="EN-US"> </span><span style="font-size: 10pt; color: gray;" lang="EN-US">(</span></span></p>
<p style="padding-left: 60px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt;" lang="EN-US"> <span style="color: teal;">s</span><span style="color: gray;">.</span><span style="color: teal;">ID</span><span style="color: gray;">,</span></span><span style="font-size: 10pt;" lang="EN-US"> </span></span></p>
<p style="padding-left: 60px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt;" lang="EN-US"><span style="color: teal;">s</span><span style="color: gray;">.</span><span style="color: teal;">Vorname</span><span style="color: gray;">,</span></span><span style="font-size: 10pt;" lang="EN-US"> </span></span></p>
<p style="padding-left: 60px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt;" lang="EN-US"><span style="color: teal;">s</span><span style="color: gray;">.</span><span style="color: teal;">Name</span><span style="color: gray;">,</span></span><span style="font-size: 10pt;" lang="EN-US"> </span></span></p>
<p style="padding-left: 60px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt;" lang="EN-US"><span style="color: teal;">s</span><span style="color: gray;">.</span><span style="color: teal;">GebDat</span> </span><span style="font-size: 10pt;" lang="EN-US"> </span></span></p>
<p style="padding-left: 30px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt; color: gray;">);</span></span></p>
<p><span style="font-family: courier new,courier;"><span style="font-size: 10pt; color: blue;">go</span><span style="font-size: 10pt;"> </span></span><span style="font-size: 11pt; font-family: &quot;Arial&quot;,&quot;sans-serif&quot;;"><span style="font-family: courier new,courier;"><br /></span> <!--[if !supportLineBreakNewLine]--><br /> <!--[endif]--></span> <span style="font-size: small;"><span style="font-family: &quot;Arial&quot;,&quot;sans-serif&quot;;">da die Client API nicht mit TVPs umgehen kann, nun die Wrapper Prozedur, die knapp gehalten ist, da die Funktionalität in der aufzurufenden Funktion liegt (der Parameter @p ist hier als output definiert um sich im SQL Server Profiler den Inhalt des Parameters als Textdata anschauen zu können)</span></span></p>
<p><span style="font-family: &quot;Arial&quot;,&quot;sans-serif&quot;;"> </span> <span style="font-family: courier new,courier;"><span style="font-size: 10pt; color: blue;" lang="EN-US">create</span><span style="font-size: 10pt;" lang="EN-US"> <span style="color: blue;">proc</span> <span style="color: teal;">dbo</span><span style="color: gray;">.</span><span style="color: teal;">tvpTestWrapper</span></span> </span></p>
<p style="padding-left: 30px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt;" lang="EN-US"><span style="color: teal;">@p </span></span></span><span style="font-family: courier new,courier;"><span style="font-size: 10pt;" lang="EN-US"><span style="color: blue;">varbinary</span><span style="color: gray;">(</span><span style="color: fuchsia;">max</span><span style="color: gray;">)</span> <span style="color: blue;">output</span></span></span></p>
<p><span style="font-family: courier new,courier;"><span style="font-size: 10pt; color: blue;" lang="EN-US">as</span></span></p>
<p><span style="font-family: courier new,courier;"><span style="font-size: 10pt; color: blue;" lang="EN-US">set</span><span style="font-size: 10pt;" lang="EN-US"> <span style="color: blue;">nocount</span> <span style="color: blue;">on</span></span></span></p>
<p><span style="font-family: courier new,courier;"><span style="font-size: 10pt; color: blue;" lang="EN-US">set</span><span style="font-size: 10pt;" lang="EN-US"> <span style="color: blue;">xact_abort</span> <span style="color: blue;">on</span></span></span></p>
<p style="padding-left: 30px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt;" lang="EN-US"> </span><span style="font-size: 10pt;" lang="EN-US"> <span style="color: blue;">declare</span> <span style="color: teal;">@tvp</span> <span style="color: blue;">as</span> <span style="color: teal;">dbo</span><span style="color: gray;">.</span><span style="color: teal;">tvpPersons</span></span></span></p>
<p style="padding-left: 30px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt; color: teal;" lang="EN-US"> </span><span style="font-size: 10pt;" lang="EN-US"> <span style="color: blue;">insert</span> <span style="color: blue;">into</span> <span style="color: teal;">@tvp</span></span><span style="font-size: 10pt;" lang="EN-US"> </span></span></p>
<p style="padding-left: 30px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt;" lang="EN-US"><span style="color: blue;">select</span> <span style="color: gray;">*</span></span> <span style="font-size: 10pt;" lang="EN-US"> <span style="color: blue;">from</span> <span style="color: teal;">dbo</span><span style="color: gray;">.</span><span style="color: teal;">fn_get_tvpPerson</span><span style="color: gray;">(</span><span style="color: teal;">@p</span><span style="color: gray;">)</span></span></span></p>
<p style="padding-left: 30px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt; color: gray;" lang="EN-US"> </span><span style="font-size: 10pt;" lang="EN-US"> </span><span style="font-size: 10pt; color: blue;">exec</span><span style="font-size: 10pt;"> <span style="color: teal;">dbo</span><span style="color: gray;">.</span><span style="color: teal;">tvpTest</span><span style="color: blue;"> </span><span style="color: teal;">@tvp</span></span></span></p>
<p><span style="font-family: courier new,courier;"><span style="font-size: 10pt; color: teal;"> </span><span style="font-size: 10pt; color: blue;">go</span></span></p>
<p><span style="font-size: small;"><span style="font-family: &quot;Arial&quot;,&quot;sans-serif&quot;;">Die Funktion hat die Aufgabe, den BLOB in die entsprechenden Häppchen zu schneiden und in die entsprechenden Datentypen zu konvertieren. Was der Client da binär anliefert, lässt sich nicht immer einfach von binary zu dem gewünschten Datentypen konvertieren. Hier im Beispiel muss die Byte Reihenfolge beim INT umgedreht werden und das Datum als String übertragen werden. Natürlich könnte man alles als String übertragen, würde damit aber auch entsprechend mehr Bandbreite benötigen. </span><span style="font-family: &quot;Arial&quot;,&quot;sans-serif&quot;;">Da bekannt ist, wie viele Bytes ein Datensatz im BLOB hat, ist mit Hilfe der Numbers Funktion das Teilen in einzelne Sätze kein Problem.</span></span></p>
<p><span style="font-family: courier new,courier;"><span style="font-size: 10pt; color: blue;" lang="EN-US">create</span><span style="font-size: 10pt;" lang="EN-US"> <span style="color: blue;">function</span> <span style="color: teal;">dbo</span><span style="color: gray;">.</span><span style="color: teal;">fn_get_tvpPerson</span></span></span></p>
<p><span style="font-family: courier new,courier;"><span style="font-size: 10pt; color: gray;" lang="EN-US">(</span></span></p>
<p style="padding-left: 30px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt;" lang="EN-US"> <span style="color: teal;">@p</span> <span style="color: blue;">varbinary</span><span style="color: gray;">(</span><span style="color: fuchsia;">max</span><span style="color: gray;">)</span></span></span></p>
<p><span style="font-family: courier new,courier;"><span style="font-size: 10pt; color: gray;" lang="EN-US">)</span></span></p>
<p><span style="font-family: courier new,courier;"><span style="font-size: 10pt; color: blue;" lang="EN-US">returns</span><span style="font-size: 10pt;" lang="EN-US"> <span style="color: teal;">@tvp</span> <span style="color: blue;">table</span></span></span></p>
<p><span style="font-family: courier new,courier;"><span style="font-size: 10pt; color: gray;" lang="EN-US">(</span><span style="font-size: 10pt;" lang="EN-US"> </span></span></p>
<p style="padding-left: 30px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt;" lang="EN-US"><span style="color: teal;">ID</span> <span style="color: blue;">int</span> <span style="color: blue;">primary</span> <span style="color: blue;">key</span> <span style="color: blue;">clustered</span><span style="color: gray;">,</span></span></span></p>
<p style="padding-left: 30px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt;" lang="EN-US"> <span style="color: teal;">Vorname</span> <span style="color: blue;">nvarchar</span><span style="color: gray;">(</span>30<span style="color: gray;">),</span></span></span></p>
<p style="padding-left: 30px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt;" lang="EN-US"> <span style="color: teal;">Name</span> <span style="color: blue;">nvarchar</span><span style="color: gray;">(</span>30<span style="color: gray;">),</span></span></span></p>
<p style="padding-left: 30px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt;" lang="EN-US"> <span style="color: teal;">GebDat</span> <span style="color: blue;">datetime</span></span></span></p>
<p><span style="font-family: courier new,courier;"><span style="font-size: 10pt; color: gray;" lang="EN-US">)</span></span></p>
<p><span style="font-family: courier new,courier;"><span style="font-size: 10pt; color: blue;" lang="EN-US">as</span></span></p>
<p><span style="font-family: courier new,courier;"><span style="font-size: 10pt; color: blue;" lang="EN-US"> </span><span style="font-size: 10pt; color: blue;" lang="EN-US">begin</span></span></p>
<p style="padding-left: 30px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt;" lang="EN-US"> </span><span style="font-size: 10pt;" lang="EN-US"> <span style="color: blue;">if</span> <span style="color: fuchsia;">datalength</span><span style="color: gray;">(</span><span style="color: teal;">@p</span><span style="color: gray;">)</span> <span style="color: gray;">%</span> 140 <span style="color: gray;">=</span> 0</span></span></p>
<p style="padding-left: 30px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt;" lang="EN-US"> <span style="color: blue;">begin</span></span></span></p>
<p style="padding-left: 60px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt; color: blue;" lang="EN-US"> </span><span style="font-size: 10pt;" lang="EN-US"> <span style="color: blue;">insert</span> <span style="color: blue;">into</span> <span style="color: teal;">@tvp</span></span></span></p>
<p style="padding-left: 60px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt;" lang="EN-US"> <span style="color: blue;">select</span></span></span></p>
<p style="padding-left: 90px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt;" lang="EN-US"> <span style="color: fuchsia;">convert</span></span><span style="font-size: 10pt; color: blue;" lang="EN-US"> </span></span></p>
<p style="padding-left: 90px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt; color: gray;" lang="EN-US">(</span></span></p>
<p style="padding-left: 120px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt;" lang="EN-US"> <span style="color: blue;">int</span><span style="color: gray;">,</span></span></span></p>
<p style="padding-left: 120px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt;" lang="EN-US"> <span style="color: fuchsia;">substring</span><span style="color: gray;">(</span><span style="color: teal;">@p</span><span style="color: gray;">,</span> 4 <span style="color: gray;">+</span><span style="color: blue;"> </span><span style="color: gray;">(</span><span style="color: teal;">n</span> <span style="color: gray;">-</span>1<span style="color: gray;">)</span> <span style="color: gray;">*</span> 140<span style="color: gray;">,</span> 1<span style="color: gray;">)</span> <span style="color: gray;">+</span></span></span></p>
<p style="padding-left: 120px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt;" lang="EN-US"> </span><span style="font-size: 10pt; color: fuchsia;">substring</span><span style="font-size: 10pt; color: gray;">(</span><span style="font-size: 10pt; color: teal;">@p</span><span style="font-size: 10pt; color: gray;">,</span><span style="font-size: 10pt;"> 3 <span style="color: gray;">+</span><span style="color: blue;"> </span><span style="color: gray;">(</span><span style="color: teal;">n</span> <span style="color: gray;">-</span>1<span style="color: gray;">)</span> <span style="color: gray;">*</span> 140<span style="color: gray;">,</span> 1<span style="color: gray;">)</span> <span style="color: gray;">+</span></span><span style="font-size: 10pt;"> </span></span></p>
<p style="padding-left: 120px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt;"><span style="color: fuchsia;">substring</span><span style="color: gray;">(</span><span style="color: teal;">@p</span><span style="color: gray;">,</span> 2 <span style="color: gray;">+</span><span style="color: blue;"> </span><span style="color: gray;">(</span><span style="color: teal;">n</span> <span style="color: gray;">-</span>1<span style="color: gray;">)</span> <span style="color: gray;">*</span> 140<span style="color: gray;">,</span> 1<span style="color: gray;">)</span> <span style="color: gray;">+</span></span></span></p>
<p style="padding-left: 120px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt;"> </span><span style="font-size: 10pt; color: fuchsia;" lang="EN-US">substring</span><span style="font-size: 10pt; color: gray;" lang="EN-US">(</span><span style="font-size: 10pt; color: teal;" lang="EN-US">@p</span><span style="font-size: 10pt; color: gray;" lang="EN-US">,</span><span style="font-size: 10pt;" lang="EN-US"> 1 <span style="color: gray;">+</span><span style="color: blue;"> </span><span style="color: gray;">(</span><span style="color: teal;">n</span> <span style="color: gray;">-</span>1<span style="color: gray;">)</span> <span style="color: gray;">*</span> 140<span style="color: gray;">,</span> 1<span style="color: gray;">)</span></span></span></p>
<p style="padding-left: 90px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt;" lang="EN-US"> <span style="color: gray;">),</span></span></span></p>
<p style="padding-left: 90px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt;" lang="EN-US"> <span style="color: fuchsia;">convert</span><span style="color: gray;">(</span><span style="color: blue;">nvarchar</span><span style="color: gray;">(</span>30<span style="color: gray;">),</span> <span style="color: fuchsia;">substring</span><span style="color: gray;">(</span><span style="color: teal;">@p</span><span style="color: gray;">,</span> 5 <span style="color: gray;">+</span><span style="color: blue;"> </span><span style="color: gray;">(</span><span style="color: teal;">n</span> <span style="color: gray;">-</span>1<span style="color: gray;">)</span> <span style="color: gray;">*</span> 140<span style="color: gray;">,</span> 60<span style="color: gray;">)),</span></span></span></p>
<p style="padding-left: 90px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt;" lang="EN-US"> <span style="color: fuchsia;">convert</span><span style="color: gray;">(</span><span style="color: blue;">nvarchar</span><span style="color: gray;">(</span>30<span style="color: gray;">),</span> <span style="color: fuchsia;">substring</span><span style="color: gray;">(</span><span style="color: teal;">@p</span><span style="color: gray;">,</span> 65 <span style="color: gray;">+</span><span style="color: blue;"> </span><span style="color: gray;">(</span><span style="color: teal;">n</span> <span style="color: gray;">-</span>1<span style="color: gray;">)</span> <span style="color: gray;">*</span> 140<span style="color: gray;">,</span> 60<span style="color: gray;">)),</span></span><span style="font-size: 10pt;" lang="EN-US"> </span></span></p>
<p style="padding-left: 90px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt;" lang="EN-US"><span style="color: fuchsia;">convert</span><span style="color: gray;">(</span><span style="color: blue;">nvarchar</span><span style="color: gray;">(</span>16<span style="color: gray;">),</span> <span style="color: fuchsia;">substring</span><span style="color: gray;">(</span><span style="color: teal;">@p</span><span style="color: gray;">,</span> 125 <span style="color: gray;">+</span><span style="color: blue;"> </span><span style="color: gray;">(</span><span style="color: teal;">n</span> <span style="color: gray;">-</span>1<span style="color: gray;">)</span> <span style="color: gray;">*</span> 140<span style="color: gray;">,</span> 16<span style="color: gray;">))</span> </span></span></p>
<p style="padding-left: 60px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt;" lang="EN-US"> <span style="color: blue;">from</span> <span style="color: teal;">dbo</span><span style="color: gray;">.</span><span style="color: teal;">Numbers</span><span style="color: gray;">(</span>1<span style="color: gray;">,</span> <span style="color: fuchsia;">datalength</span><span style="color: gray;">(</span><span style="color: teal;">@p</span><span style="color: gray;">)/</span>140<span style="color: gray;">)</span></span></span></p>
<p style="padding-left: 30px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt; color: gray;" lang="EN-US"> </span><span style="font-size: 10pt;" lang="EN-US"> <span style="color: blue;">end</span></span><span style="font-size: 10pt;" lang="EN-US"> </span><span style="font-size: 10pt;" lang="EN-US"> </span></span></p>
<p style="padding-left: 30px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt;" lang="EN-US"><span style="color: blue;">return</span></span><span style="font-size: 10pt; color: blue;" lang="EN-US"> </span></span></p>
<p><span style="font-family: courier new,courier;"><span style="font-size: 10pt; color: blue;" lang="EN-US">end</span></span></p>
<p><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;" lang="EN-US"> </span> <span style="font-size: small;"><span style="font-family: &quot;Arial&quot;,&quot;sans-serif&quot;;">Als Test-Client fungiert hier VBA mit ADO 2.8.</span></span></p>
<p><span style="font-size: small;"><span style="font-family: &quot;Arial&quot;,&quot;sans-serif&quot;;"> Nachfolgend</span><span style="font-family: &quot;Arial&quot;,&quot;sans-serif&quot;;" lang="EN-US"> die Klasse TVP4ADO28</span></span> <span style="font-family: &quot;Arial&quot;,&quot;sans-serif&quot;;" lang="EN-US"> </span></p>
<p><span style="font-family: courier new,courier;"><br />Private adoStream As ADODB.stream<br /><br />Private Type typRecord<br /> ID As Long              '4 Byte<br /> Vorname As String * 30  '60 Byte<br /> Name As String * 30     '60 Byte<br /> GebDat As String * 8    '16 Byte<br />End Type<br /><br />Private Type typBinRecord<br /> record(1 To 140) As Byte<br />End Type<br /><br />Private Sub Class_Initialize()<br /> <br /> Set adoStream = New ADODB.stream<br /> adoStream.Type = adTypeBinary<br /> adoStream.Mode = adModeReadWrite<br /> adoStream.Open<br /><br />End Sub<br /><br /><br />Public Sub AddRecord(ID As Long, Vorname As String, Name As String, GebDat As Date)<br /><br /> Dim t As typRecord<br /> Dim r As typBinRecord<br /> Dim s() As String<br /> <br /> s() = Split(CStr(GebDat), ".")<br /> <br /> t.ID = ID<br /> t.Vorname = Vorname<br /> t.Name = Name<br /> t.GebDat = s(2) &amp; s(1) &amp; s(0)<br /><br /> LSet r = t<br /> <br /> adoStream.Write r.record<br /> <br />End Sub<br /><br />Public Property Get GetStream() As ADODB.stream<br /><br /> adoStream.Position = 0<br /> Set GetStream = adoStream<br /><br />End Property<br /><br />Private Sub Class_Terminate()<br /><br /> adoStream.Close<br /> Set adoStream = Nothing<br /><br />End Sub<br /><br /></span></p>
<p><span style="font-family: &quot;Arial&quot;,&quot;sans-serif&quot;;" lang="EN-US">und hier der Aufruf (</span><span style="font-size: small;"><span style="font-family: &quot;Arial&quot;,&quot;sans-serif&quot;;">Der Application Name im Connection String dient zum einfachen Filtern im SQL Server Profiler)</span></span></p>
<p><span style="font-family: courier new,courier;">Public Sub Test()<br /><br /> Dim conn As New ADODB.Connection<br /> Dim com As New ADODB.Command<br /> Dim i As Long<br /> <br /> Set tvp = New TVP4ADO28<br /> <br /> For i = 1 To 10000<br /><br /> tvp.AddRecord i, "Klaus", "Müller", "09.06.1957"<br /><br /> Next i<br /><br /><br /> With conn<br /><br /> .ConnectionString = _<br /> "Provider=SQLNCLI10;" &amp; _<br /> "Integrated Security=SSPI;" &amp; _<br /> "Persist Security Info=True;" &amp; _<br /> "Initial Catalog=Test;" &amp; _<br /> "Data Source=MeinServer\MeineInstanz;" &amp; _<br /> "Application Name=MeineApplikation"<br /><br /> .CursorLocation = adUseClient<br /> .IsolationLevel = adXactReadCommitted<br /> .Mode = adModeReadWrite<br /><br /> .Open<br /><br /> End With<br /><br /> With com<br /><br /> .CommandType = adCmdStoredProc<br /> .CommandText = "dbo.tvpTestWrapper"<br /> .ActiveConnection = conn<br /> .NamedParameters = False<br /><br />.Parameters.Append .CreateParameter("@p", adVarBinary, adParamInputOutput, _<br /> tvp.GetStream.Size, tvp.GetStream.Read)<br /><br /> Dim t As Single<br /> <br /> t = Timer<br /> <br /> .Execute Options:=adExecuteNoRecords<br /><br /> t = Timer - t<br /> <br /> End With<br /><br /> Debug.Print t<br /><br /> conn.Close<br /> <br /> Set com = Nothing<br /> Set conn = Nothing<br /> Set tvp = Nothing<br /><br />End Sub<br /></span></p>
<p><span style="font-family: &quot;Arial&quot;,&quot;sans-serif&quot;;" lang="EN-US">Viele Grüße</span></p>
<p><span style="font-family: &quot;Arial&quot;,&quot;sans-serif&quot;;" lang="EN-US">Christoph Ingenhaag<br /></span></p>
<p> </p>]]></content:encoded>
								<comments>https://www.insidesql.org/blogs/christoph_ingenhaag/2010/09/03/table-value-parameters-tvp-und-kein-passendes-client-api-was-nun#comments</comments>
			<wfw:commentRss>https://www.insidesql.org/blogs/christoph_ingenhaag/?tempskin=_rss2&#38;disp=comments&#38;p=1279</wfw:commentRss>
		</item>
				<item>
			<title>Rückgaben von Stored Procedures ad hoc weiterverarbeiten</title>
			<link>https://www.insidesql.org/blogs/christoph_ingenhaag/2010/08/31/rueckgaben-von-stored-procedures-ad-hoc-weiterverarbeiten</link>
			<pubDate>Tue, 31 Aug 2010 14:03:25 +0000</pubDate>			<dc:creator>Christoph Ingenhaag</dc:creator>
			<category domain="main">TSQL</category>			<guid isPermaLink="false">1222@https://www.insidesql.org/blogs/</guid>
						<description>&lt;p&gt;&lt;span style=&quot;font-family: arial,helvetica,sans-serif;&quot;&gt;Wenn man die Rückgabe eines Resultsets einer Stored Procedure ad hoc in einer neuen Tabelle oder direkt weiterverarbeiten möchte, kann man mit Hilfe&lt;/span&gt; von &lt;span style=&quot;font-family: courier new,courier;&quot;&gt;OPENROWSET (&lt;span style=&quot;font-family: arial,helvetica,sans-serif;&quot;&gt;siehe Hilfe, Ad Hoc Distributed Queries müssen erlaubt sein) ein wenig trick&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: arial,helvetica,sans-serif;&quot;&gt;sen:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: arial,helvetica,sans-serif;&quot;&gt;Der Einfachheit halber habe ich für das Beispiel die Stored Procedure sp_help verwendet:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: arial,helvetica,sans-serif;&quot;&gt;Rückgabe in eine Tabelle schreiben&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: blue;&quot; lang=&quot;EN-US&quot;&gt;select&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: gray;&quot;&gt;*&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: blue;&quot; lang=&quot;EN-US&quot;&gt;into&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: teal;&quot;&gt;#t1&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: blue;&quot; lang=&quot;EN-US&quot;&gt;from&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;openrowset&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: gray;&quot; lang=&quot;EN-US&quot;&gt;(&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 30px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: red;&quot;&gt;&#039;SQLNCLI&#039;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; color: gray;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 30px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: red;&quot;&gt;&#039;Server=MeinServer\MeineInstanz;Trusted_Connection=yes;&#039;&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 30px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: red;&quot;&gt;&#039;exec sp_help;&#039;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: gray;&quot; lang=&quot;EN-US&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;as&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;a&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: gray;&quot; lang=&quot;EN-US&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: blue;&quot; lang=&quot;EN-US&quot;&gt;select&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: gray;&quot;&gt;*&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;from&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;#t1&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: teal;&quot; lang=&quot;EN-US&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: blue;&quot; lang=&quot;EN-US&quot;&gt;go&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: blue;&quot; lang=&quot;EN-US&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: blue;&quot; lang=&quot;EN-US&quot;&gt;drop&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;table&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;#t1&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: teal;&quot; lang=&quot;EN-US&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: blue;&quot; lang=&quot;EN-US&quot;&gt;go&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;&quot; lang=&quot;EN-US&quot;&gt; &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: arial,helvetica,sans-serif;&quot;&gt;oder einfach als Funktion weiterverwenden&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: blue;&quot; lang=&quot;EN-US&quot;&gt;create&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;function&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;dbo&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;fn_help&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;()&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: blue;&quot; lang=&quot;EN-US&quot;&gt;returns&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;table&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: blue;&quot; lang=&quot;EN-US&quot;&gt;as&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: blue;&quot; lang=&quot;EN-US&quot;&gt;return&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: gray;&quot; lang=&quot;EN-US&quot;&gt;(&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 30px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;select&lt;/span&gt; &lt;span style=&quot;color: gray;&quot;&gt;*&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 30px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;from&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;openrowset&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 30px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: blue;&quot; lang=&quot;EN-US&quot;&gt; &lt;/span&gt;&lt;span style=&quot;font-size: 10pt; color: gray;&quot; lang=&quot;EN-US&quot;&gt;(&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 60px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: red;&quot;&gt;&#039;SQLNCLI&#039;&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 60px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: red;&quot;&gt;&#039;Server=&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;MeinServer\MeineInstanz&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;;Trusted_Connection=yes;&#039;&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 60px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: red;&quot;&gt;&#039;exec sp_help;&#039;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 30px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: gray;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;as&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;a&lt;/span&gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: gray;&quot; lang=&quot;EN-US&quot;&gt;);&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: blue;&quot; lang=&quot;EN-US&quot;&gt;go&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: blue;&quot; lang=&quot;EN-US&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: blue;&quot; lang=&quot;EN-US&quot;&gt;select&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: gray;&quot;&gt;*&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;from&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;dbo&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;fn_help&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;()&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: gray;&quot; lang=&quot;EN-US&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: blue;&quot;&gt;drop&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;function&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;dbo&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;fn_help&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: arial,helvetica,sans-serif;&quot;&gt;Dieses Vorgehen sollte aber die Ausnahme bleiben, ad hoc eben.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: arial,helvetica,sans-serif;&quot;&gt;Ergänzend siehe auch &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: arial,helvetica,sans-serif;&quot;&gt;http://www.insidesql.org/blogs/uricken/2010/08/20/verwendung-von-udf-auf-linked-server&lt;/span&gt;&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: arial,helvetica,sans-serif;&quot;&gt;Viele Grüße&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: arial,helvetica,sans-serif;&quot;&gt;Christoph Ingenhaag&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;</description>
			<content:encoded><![CDATA[<p><span style="font-family: arial,helvetica,sans-serif;">Wenn man die Rückgabe eines Resultsets einer Stored Procedure ad hoc in einer neuen Tabelle oder direkt weiterverarbeiten möchte, kann man mit Hilfe</span> von <span style="font-family: courier new,courier;">OPENROWSET (<span style="font-family: arial,helvetica,sans-serif;">siehe Hilfe, Ad Hoc Distributed Queries müssen erlaubt sein) ein wenig trick</span></span><span style="font-family: arial,helvetica,sans-serif;">sen:</span></p>
<p><span style="font-family: arial,helvetica,sans-serif;">Der Einfachheit halber habe ich für das Beispiel die Stored Procedure sp_help verwendet:</span></p>
<p><span style="font-family: arial,helvetica,sans-serif;">Rückgabe in eine Tabelle schreiben<br /></span></p>
<p><span style="font-family: courier new,courier;"><span style="font-size: 10pt; color: blue;" lang="EN-US">select</span><span style="font-size: 10pt;" lang="EN-US"> <span style="color: gray;">*</span></span></span></p>
<p><span style="font-family: courier new,courier;"><span style="font-size: 10pt; color: blue;" lang="EN-US">into</span><span style="font-size: 10pt;" lang="EN-US"> <span style="color: teal;">#t1</span></span></span></p>
<p><span style="font-family: courier new,courier;"><span style="font-size: 10pt; color: blue;" lang="EN-US">from</span><span style="font-size: 10pt;" lang="EN-US"> <span style="color: blue;">openrowset</span></span></span></p>
<p><span style="font-family: courier new,courier;"><span style="font-size: 10pt; color: gray;" lang="EN-US">(</span></span></p>
<p style="padding-left: 30px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt; color: red;">'SQLNCLI'</span><span style="font-size: 10pt; color: gray;">,</span><span style="font-size: 10pt;"> </span></span></p>
<p style="padding-left: 30px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt;" lang="EN-US"> <span style="color: red;">'Server=MeinServer\MeineInstanz;Trusted_Connection=yes;'</span><span style="color: gray;">,</span></span></span></p>
<p style="padding-left: 30px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt;" lang="EN-US"> <span style="color: red;">'exec sp_help;'</span></span></span></p>
<p><span style="font-family: courier new,courier;"><span style="font-size: 10pt; color: gray;" lang="EN-US">)</span><span style="font-size: 10pt;" lang="EN-US"> <span style="color: blue;">as</span> <span style="color: teal;">a</span><span style="color: gray;">;</span></span></span></p>
<p><span style="font-family: courier new,courier;"><span style="font-size: 10pt; color: gray;" lang="EN-US"> </span></span></p>
<p><span style="font-family: courier new,courier;"><br /></span></p>
<p><span style="font-family: courier new,courier;"><span style="font-size: 10pt; color: blue;" lang="EN-US">select</span><span style="font-size: 10pt;" lang="EN-US"> <span style="color: gray;">*</span> <span style="color: blue;">from</span> <span style="color: teal;">#t1</span></span></span></p>
<p><span style="font-family: courier new,courier;"><span style="font-size: 10pt; color: teal;" lang="EN-US"> </span></span></p>
<p><span style="font-family: courier new,courier;"><span style="font-size: 10pt; color: blue;" lang="EN-US">go</span></span></p>
<p><span style="font-family: courier new,courier;"><span style="font-size: 10pt; color: blue;" lang="EN-US"> </span></span></p>
<p><span style="font-family: courier new,courier;"><br /></span></p>
<p><span style="font-family: courier new,courier;"><span style="font-size: 10pt; color: blue;" lang="EN-US">drop</span><span style="font-size: 10pt;" lang="EN-US"> <span style="color: blue;">table</span> <span style="color: teal;">#t1</span></span></span></p>
<p><span style="font-family: courier new,courier;"><span style="font-size: 10pt; color: teal;" lang="EN-US"> </span></span></p>
<p><span style="font-family: courier new,courier;"><span style="font-size: 10pt; color: blue;" lang="EN-US">go</span></span></p>
<p><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;" lang="EN-US"> </span></p>
<p><span style="font-family: arial,helvetica,sans-serif;">oder einfach als Funktion weiterverwenden<br /></span></p>
<p><span style="font-family: courier new,courier;"><span style="font-size: 10pt; color: blue;" lang="EN-US">create</span><span style="font-size: 10pt;" lang="EN-US"> <span style="color: blue;">function</span> <span style="color: teal;">dbo</span><span style="color: gray;">.</span><span style="color: teal;">fn_help</span><span style="color: gray;">()</span></span></span></p>
<p><span style="font-family: courier new,courier;"><span style="font-size: 10pt; color: blue;" lang="EN-US">returns</span><span style="font-size: 10pt;" lang="EN-US"> <span style="color: blue;">table</span></span></span></p>
<p><span style="font-family: courier new,courier;"><span style="font-size: 10pt; color: blue;" lang="EN-US">as</span></span></p>
<p><span style="font-family: courier new,courier;"><span style="font-size: 10pt; color: blue;" lang="EN-US">return</span></span></p>
<p><span style="font-family: courier new,courier;"><span style="font-size: 10pt; color: gray;" lang="EN-US">(</span></span></p>
<p style="padding-left: 30px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt;" lang="EN-US"> <span style="color: blue;">select</span> <span style="color: gray;">*</span></span></span></p>
<p style="padding-left: 30px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt;" lang="EN-US"> <span style="color: blue;">from</span> <span style="color: blue;">openrowset</span></span></span></p>
<p style="padding-left: 30px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt; color: blue;" lang="EN-US"> </span><span style="font-size: 10pt; color: gray;" lang="EN-US">(</span></span></p>
<p style="padding-left: 60px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt;" lang="EN-US"> <span style="color: red;">'SQLNCLI'</span><span style="color: gray;">,</span> </span></span></p>
<p style="padding-left: 60px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt;" lang="EN-US"> <span style="color: red;">'Server=</span></span></span><span style="font-family: courier new,courier;"><span style="font-size: 10pt;" lang="EN-US"><span style="color: red;">MeinServer\MeineInstanz</span></span></span><span style="font-family: courier new,courier;"><span style="font-size: 10pt;" lang="EN-US"><span style="color: red;">;Trusted_Connection=yes;'</span><span style="color: gray;">,</span></span></span></p>
<p style="padding-left: 60px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt;" lang="EN-US"> <span style="color: red;">'exec sp_help;'</span></span></span></p>
<p style="padding-left: 30px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt;" lang="EN-US"> <span style="color: gray;">)</span> <span style="color: blue;">as</span> <span style="color: teal;">a</span> </span></span></p>
<p><span style="font-family: courier new,courier;"><span style="font-size: 10pt; color: gray;" lang="EN-US">);</span><span style="font-size: 10pt;" lang="EN-US"> </span></span></p>
<p><span style="font-family: courier new,courier;"><span style="font-size: 10pt; color: blue;" lang="EN-US">go</span></span></p>
<p><span style="font-family: courier new,courier;"><span style="font-size: 10pt; color: blue;" lang="EN-US"> </span></span></p>
<p><span style="font-family: courier new,courier;"><span style="font-size: 10pt; color: blue;" lang="EN-US">select</span><span style="font-size: 10pt;" lang="EN-US"> <span style="color: gray;">*</span> <span style="color: blue;">from</span> <span style="color: teal;">dbo</span><span style="color: gray;">.</span><span style="color: teal;">fn_help</span><span style="color: gray;">()</span></span></span></p>
<p><span style="font-family: courier new,courier;"><span style="font-size: 10pt; color: gray;" lang="EN-US"> </span></span></p>
<p><span style="font-family: courier new,courier;"><span style="font-size: 10pt; color: blue;">drop</span><span style="font-size: 10pt;"> <span style="color: blue;">function</span> <span style="color: teal;">dbo</span><span style="color: gray;">.</span><span style="color: teal;">fn_help</span></span></span></p>
<p><span style="font-family: arial,helvetica,sans-serif;">Dieses Vorgehen sollte aber die Ausnahme bleiben, ad hoc eben.</span></p>
<p><span style="font-family: arial,helvetica,sans-serif;">Ergänzend siehe auch </span></p>
<p><span style="font-family: arial,helvetica,sans-serif;">http://www.insidesql.org/blogs/uricken/2010/08/20/verwendung-von-udf-auf-linked-server</span></p>
<p> </p>
<p><span style="font-family: arial,helvetica,sans-serif;">Viele Grüße</span></p>
<p><span style="font-family: arial,helvetica,sans-serif;">Christoph Ingenhaag<br /></span></p>
<p> </p>]]></content:encoded>
								<comments>https://www.insidesql.org/blogs/christoph_ingenhaag/2010/08/31/rueckgaben-von-stored-procedures-ad-hoc-weiterverarbeiten#comments</comments>
			<wfw:commentRss>https://www.insidesql.org/blogs/christoph_ingenhaag/?tempskin=_rss2&#38;disp=comments&#38;p=1222</wfw:commentRss>
		</item>
				<item>
			<title>In IN ist mehr drin</title>
			<link>https://www.insidesql.org/blogs/christoph_ingenhaag/2010/08/17/in_in_ist_mehr_drin</link>
			<pubDate>Tue, 17 Aug 2010 08:30:04 +0000</pubDate>			<dc:creator>Christoph Ingenhaag</dc:creator>
			<category domain="main">TSQL</category>			<guid isPermaLink="false">931@https://www.insidesql.org/blogs/</guid>
						<description>&lt;p&gt; &lt;/p&gt;
&lt;p&gt;IN Operator&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;test_expression [ NOT ] IN &lt;br /&gt; &lt;strong&gt;(&lt;/strong&gt; &lt;em&gt;subquery&lt;/em&gt; | &lt;em&gt;expression&lt;/em&gt; [ &lt;strong&gt;,&lt;/strong&gt;...&lt;em&gt;n &lt;/em&gt;]&lt;br /&gt; &lt;strong&gt;)&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Bekannt ist, das man mit dem IN Operator prüfen kann, ob Werte in einer Spalte vorhanden sind:&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: blue;&quot;&gt;where&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; color: blue;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt; &lt;span style=&quot;color: teal;&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt;Spalte1&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: gray;&quot;&gt;&lt;span style=&quot;color: gray;&quot;&gt;in&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;(&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #808080;&quot;&gt;1,2,3&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;&lt;span style=&quot;color: gray;&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: blue;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt;&lt;span style=&quot;color: gray;&quot;&gt;&lt;span style=&quot;color: gray;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;das es auch andersherum geht, ist eher unbekannt. Obwohl nach Onlinehilfe die test_expression &quot;nur&quot; ein gültiger Ausdruck sein muss:&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: blue;&quot;&gt;where&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt; 1 &lt;span style=&quot;color: gray;&quot;&gt;in&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt; &lt;/span&gt;(&lt;span style=&quot;color: teal;&quot;&gt;Spalte1&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;Spalte2&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;Spalte3&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;siehe hierzu auch:&lt;/p&gt;
&lt;p&gt;&lt;a title=&quot;http://blogs.technet.com/wardpond/archive/2009/09/04/database-programming-did-you-know-in-can-do-this.aspx&quot; href=&quot;http://blogs.technet.com/wardpond/archive/2009/09/04/database-programming-did-you-know-in-can-do-this.aspx&quot;&gt;http://blogs.technet.com/wardpond/archive/2009/09/04/database-programming-did-you-know-in-can-do-this.aspx&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://sqlblog.com/blogs/denis_gobo/archive/2009/04/09/13186.aspx&quot;&gt;http://sqlblog.com/blogs/denis_gobo/archive/2009/04/09/13186.aspx&lt;/a&gt;&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;Gültige Ausdrücke sind&lt;/p&gt;
&lt;pre&gt;{ &lt;em&gt;constant &lt;/em&gt;| &lt;em&gt;scalar_function &lt;/em&gt;| [ &lt;em&gt;table_name&lt;/em&gt;&lt;strong&gt;.&lt;/strong&gt; ] &lt;em&gt;column &lt;/em&gt;| &lt;em&gt;variable &lt;/em&gt;&lt;br /&gt;
    &lt;em&gt;    &lt;/em&gt;| &lt;strong&gt;(&lt;/strong&gt; &lt;em&gt;expression &lt;/em&gt;&lt;strong&gt;)&lt;/strong&gt;&lt;em&gt; &lt;/em&gt;| &lt;strong&gt;(&lt;/strong&gt; &lt;em&gt;scalar_subquery &lt;/em&gt;&lt;strong&gt;)&lt;/strong&gt; &lt;br /&gt;
    | { &lt;em&gt;unary_operator &lt;/em&gt;} &lt;em&gt;expression&lt;/em&gt; &lt;br /&gt;
    | &lt;em&gt;expression&lt;/em&gt; { &lt;em&gt;binary_operator &lt;/em&gt;} &lt;em&gt;expression &lt;/em&gt;&lt;br /&gt;
&lt;em&gt;    | ranking_windowed_function | aggregate_windowed_function&lt;/em&gt;&lt;br /&gt;
}&lt;/pre&gt;
&lt;p&gt;also &lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: blue;&quot;&gt;where&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt; (Ausdruck) &lt;span style=&quot;color: gray;&quot;&gt;in&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt; &lt;/span&gt;(&lt;span style=&quot;color: teal;&quot;&gt;Spalte1&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;Spalte2&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;Spalte3&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Aber der Ausdruck darf nicht mehr als eine Zeile und Spalte zurückgeben (skalarer Ausdruck). Mit einem kleinen Trick kann man aber trotzdem mehrere Werte übergeben. Dazu ein Beispiel mit Testdaten:&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: blue;&quot; lang=&quot;EN-US&quot;&gt;begin&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;try&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;drop&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;table&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;#t&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;end&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;try&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;begin&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;catch&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;end&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;catch&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: gray;&quot; lang=&quot;EN-US&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: blue;&quot; lang=&quot;EN-US&quot;&gt;select&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 30px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;identity&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt; 1&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt; 1&lt;span style=&quot;color: gray;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;id&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 30px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: gray;&quot;&gt;*&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: blue;&quot; lang=&quot;EN-US&quot;&gt;into&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: teal;&quot;&gt;#t&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: blue;&quot; lang=&quot;EN-US&quot;&gt;from&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: gray;&quot; lang=&quot;EN-US&quot;&gt;(&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;values&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 30px;&quot;&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt;0,0,0,0,0,0), &lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt;1,0,0,0,0,0), &lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt;0,1,0,0,0,0),&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 30px;&quot;&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt;0,0,1,0,0,0), &lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt;0,0,0,1,0,0), &lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt;0,0,0,0,1,0),&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 30px;&quot;&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt;0,0,0,0,0,1), &lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt;2,0,0,0,0,0), &lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt;0,2,0,0,0,0),&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 30px;&quot;&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt;0,0,2,0,0,0), &lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt;0,0,0,2,0,0), &lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt;0,0,0,0,2,0),&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 30px;&quot;&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt;0,0,0,0,0,2), &lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt;3,0,0,0,0,0), &lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt;0,3,0,0,0,0),&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 30px;&quot;&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt;0,0,3,0,0,0), &lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt;0,0,0,3,0,0), &lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt;0,0,0,0,3,0),&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 30px;&quot;&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt;0,0,0,0,0,3)&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: gray;&quot; lang=&quot;EN-US&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt; &lt;span style=&quot;color: teal;&quot;&gt;t&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;sp1&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;sp2&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;sp3&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;sp4&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;sp5&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;sp6&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;);&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;Ein Crossjoin mit den zu überprüfenden Werten funktioniert:&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: blue;&quot; lang=&quot;EN-US&quot;&gt;select&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;distinct&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt; id&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: blue;&quot; lang=&quot;EN-US&quot;&gt;from&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: teal;&quot;&gt;#t&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: gray;&quot; lang=&quot;EN-US&quot;&gt;(&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 30px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;select&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;arg&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 30px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;from &lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;values &lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;(&lt;/span&gt;1&lt;span style=&quot;color: gray;&quot;&gt;),&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;(&lt;/span&gt;2&lt;span style=&quot;color: gray;&quot;&gt;))&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;a&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;arg&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: gray;&quot; lang=&quot;EN-US&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: teal;&quot;&gt;t&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: blue;&quot; lang=&quot;EN-US&quot;&gt;where&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 30px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt;arg&lt;/span&gt; &lt;span style=&quot;color: gray;&quot;&gt;in&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;sp1&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;sp2&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;sp3&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;sp4&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;sp5&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;sp6&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;);&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;Noch ein anderes Beispiel, mit dem man alle Lottozahlen 6 aus 49 inkl. Zusatzzahl erzeugen kann (vielleicht weiß ja jemand, wie man damit den Jackpot knacken kann ;-) )&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: blue;&quot; lang=&quot;EN-US&quot;&gt;;with&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: teal;&quot;&gt;n&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;as&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: gray;&quot; lang=&quot;EN-US&quot;&gt;(&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 30px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;select&lt;/span&gt; 1 &lt;span style=&quot;color: teal;&quot;&gt;n&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 30px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 30px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;union&lt;/span&gt; &lt;span style=&quot;color: gray;&quot;&gt;all&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 30px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 30px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;select&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;n&lt;/span&gt; &lt;span style=&quot;color: gray;&quot;&gt;+&lt;/span&gt; 1&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 30px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;from&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;n&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 30px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;where&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 60px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt;n&lt;/span&gt; &lt;span style=&quot;color: gray;&quot;&gt;&amp;lt;&lt;/span&gt; 49&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: gray;&quot; lang=&quot;EN-US&quot;&gt;),&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: teal;&quot; lang=&quot;EN-US&quot;&gt;z&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;as&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: gray;&quot; lang=&quot;EN-US&quot;&gt;(&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 30px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;select&lt;/span&gt; 1 &lt;span style=&quot;color: teal;&quot;&gt;z&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 30px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 30px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;union&lt;/span&gt; &lt;span style=&quot;color: gray;&quot;&gt;all&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 30px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 30px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;select&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;z&lt;/span&gt; &lt;span style=&quot;color: gray;&quot;&gt;+&lt;/span&gt; 1&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 30px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;from&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;z&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 30px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;where&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 60px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt;z&lt;/span&gt; &lt;span style=&quot;color: gray;&quot;&gt;&amp;lt;&lt;/span&gt; 10&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: gray;&quot; lang=&quot;EN-US&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: gray;&quot; lang=&quot;EN-US&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; color: teal;&quot; lang=&quot;EN-US&quot;&gt;lotto&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;as&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: gray;&quot; lang=&quot;EN-US&quot;&gt;(&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 30px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;select&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 60px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt;n1&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;n&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;as&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;Zahl_1&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 60px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: teal;&quot;&gt;n2&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; color: gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; color: teal;&quot;&gt;n&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;as&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;Zahl_2&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 60px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt;n3&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;n&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;as&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;Zahl_3&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 60px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt;n4&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;n&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;as&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;Zahl_4&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 60px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt;n5&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;n&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;as&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;Zahl_5&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 60px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt;n6&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;n&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;as&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;Zahl_6&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 60px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt;z&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;z&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;as&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;Zusatzzahl&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 30px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;from&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;n&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;n1&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;n&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;n2&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;n&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;n3&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;n&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;n4&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;n&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;n5&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;n&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;n6&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;z&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 30px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: blue;&quot; lang=&quot;EN-US&quot;&gt;where&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 60px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt;n1&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;n&lt;/span&gt; &lt;span style=&quot;color: gray;&quot;&gt;not&lt;/span&gt; &lt;span style=&quot;color: gray;&quot;&gt;in&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;n2&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;n&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;n3&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;n&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;n4&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;n&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;n5&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;n&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;n6&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;n&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: gray;&quot;&gt;and&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 60px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt;n2&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;n&lt;/span&gt; &lt;span style=&quot;color: gray;&quot;&gt;not&lt;/span&gt; &lt;span style=&quot;color: gray;&quot;&gt;in&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;n1&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;n&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;n3&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;n&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;n4&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;n&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;n5&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;n&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;n6&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;n&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: gray;&quot;&gt;and&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 60px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt;n3&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;n&lt;/span&gt; &lt;span style=&quot;color: gray;&quot;&gt;not&lt;/span&gt; &lt;span style=&quot;color: gray;&quot;&gt;in&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;n1&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;n&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;n2&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;n&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;n4&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;n&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;n5&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;n&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;n6&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;n&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: gray;&quot;&gt;and&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 60px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt;n4&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;n&lt;/span&gt; &lt;span style=&quot;color: gray;&quot;&gt;not&lt;/span&gt; &lt;span style=&quot;color: gray;&quot;&gt;in&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;n1&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;n&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;n2&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;n&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;n3&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;n&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;n5&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;n&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;n6&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;n&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: gray;&quot;&gt;and&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 60px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt;n5&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;n&lt;/span&gt; &lt;span style=&quot;color: gray;&quot;&gt;not&lt;/span&gt; &lt;span style=&quot;color: gray;&quot;&gt;in&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;n1&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;n&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;n2&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;n&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;n3&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;n&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;n4&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;n&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;n6&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;n&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: gray;&quot;&gt;and&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 60px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt;n6&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;n&lt;/span&gt; &lt;span style=&quot;color: gray;&quot;&gt;not&lt;/span&gt; &lt;span style=&quot;color: gray;&quot;&gt;in&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;n1&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;n&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;n2&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;n&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;n3&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;n&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;n4&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;n&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;n5&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;n&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: gray;&quot;&gt;and&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 60px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt;n2&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;n&lt;/span&gt; &lt;span style=&quot;color: gray;&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;n1&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;n&lt;/span&gt; &lt;span style=&quot;color: gray;&quot;&gt;and&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 60px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt;n3&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;n&lt;/span&gt; &lt;span style=&quot;color: gray;&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;n2&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;n&lt;/span&gt; &lt;span style=&quot;color: gray;&quot;&gt;and&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 60px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt;n4&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;n&lt;/span&gt; &lt;span style=&quot;color: gray;&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;n3&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;n&lt;/span&gt; &lt;span style=&quot;color: gray;&quot;&gt;and&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 60px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt;n5&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;n&lt;/span&gt; &lt;span style=&quot;color: gray;&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;n4&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;n&lt;/span&gt; &lt;span style=&quot;color: gray;&quot;&gt;and&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 60px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt;n6&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;n&lt;/span&gt; &lt;span style=&quot;color: gray;&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;n5&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;n&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: gray;&quot; lang=&quot;EN-US&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: blue;&quot; lang=&quot;EN-US&quot;&gt;select&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;top&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;(&lt;/span&gt;1&lt;span style=&quot;color: gray;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: gray;&quot;&gt;*&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; color: green;&quot; lang=&quot;EN-US&quot;&gt; &lt;/span&gt;&lt;span style=&quot;font-size: 10pt; color: green;&quot;&gt;-- aus 139838160 Zeilen&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: blue;&quot; lang=&quot;EN-US&quot;&gt;from&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: teal;&quot;&gt;lotto&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: blue;&quot; lang=&quot;EN-US&quot;&gt;order&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;by&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 30px;&quot;&gt;&lt;span style=&quot;font-family: courier new,courier;&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: fuchsia;&quot; lang=&quot;EN-US&quot;&gt;newid&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; color: gray;&quot; lang=&quot;EN-US&quot;&gt;();&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Viele Grüße&lt;/p&gt;
&lt;p&gt;Christoph Ingenhaag&lt;/p&gt;</description>
			<content:encoded><![CDATA[<p> </p>
<p>IN Operator</p>
<p><span style="font-family: courier new,courier;">test_expression [ NOT ] IN <br /> <strong>(</strong> <em>subquery</em> | <em>expression</em> [ <strong>,</strong>...<em>n </em>]<br /> <strong>)</strong></span></p>
<p>Bekannt ist, das man mit dem IN Operator prüfen kann, ob Werte in einer Spalte vorhanden sind:</p>
<p><span style="font-family: courier new,courier;"><span style="font-size: 10pt; color: blue;">where</span><span style="font-size: 10pt; color: blue;"><span style="font-size: 10pt;"> <span style="color: teal;"><span style="color: teal;">Spalte1</span></span> <span style="color: gray;"><span style="color: gray;">in</span></span><span style="color: blue;"><span style="color: blue;"> </span><span style="color: gray;">(</span></span><span style="color: #808080;">1,2,3</span><span style="color: gray;"><span style="color: gray;">)</span></span></span></span></span></p>
<p><span style="font-family: courier new,courier;"><span style="font-size: 10pt; color: blue;"><span style="font-size: 10pt;"><span style="color: gray;"><span style="color: gray;"><br /></span></span></span></span></span></p>
<p>das es auch andersherum geht, ist eher unbekannt. Obwohl nach Onlinehilfe die test_expression "nur" ein gültiger Ausdruck sein muss:</p>
<p><span style="font-family: courier new,courier;"><span style="font-size: 10pt; color: blue;">where</span><span style="font-size: 10pt;"> 1 <span style="color: gray;">in</span><span style="color: blue;"> </span>(<span style="color: teal;">Spalte1</span><span style="color: gray;">,</span> <span style="color: teal;">Spalte2</span><span style="color: gray;">,</span> <span style="color: teal;">Spalte3</span><span style="color: gray;">)</span></span></span></p>
<p> </p>
<p>siehe hierzu auch:</p>
<p><a title="http://blogs.technet.com/wardpond/archive/2009/09/04/database-programming-did-you-know-in-can-do-this.aspx" href="http://blogs.technet.com/wardpond/archive/2009/09/04/database-programming-did-you-know-in-can-do-this.aspx">http://blogs.technet.com/wardpond/archive/2009/09/04/database-programming-did-you-know-in-can-do-this.aspx</a></p>
<p><a href="http://sqlblog.com/blogs/denis_gobo/archive/2009/04/09/13186.aspx">http://sqlblog.com/blogs/denis_gobo/archive/2009/04/09/13186.aspx</a></p>
<p> </p>
<p>Gültige Ausdrücke sind</p>
<pre>{ <em>constant </em>| <em>scalar_function </em>| [ <em>table_name</em><strong>.</strong> ] <em>column </em>| <em>variable </em><br />
    <em>    </em>| <strong>(</strong> <em>expression </em><strong>)</strong><em> </em>| <strong>(</strong> <em>scalar_subquery </em><strong>)</strong> <br />
    | { <em>unary_operator </em>} <em>expression</em> <br />
    | <em>expression</em> { <em>binary_operator </em>} <em>expression </em><br />
<em>    | ranking_windowed_function | aggregate_windowed_function</em><br />
}</pre>
<p>also <span style="font-family: courier new,courier;"><span style="font-size: 10pt; color: blue;">where</span><span style="font-size: 10pt;"> (Ausdruck) <span style="color: gray;">in</span><span style="color: blue;"> </span>(<span style="color: teal;">Spalte1</span><span style="color: gray;">,</span> <span style="color: teal;">Spalte2</span><span style="color: gray;">,</span> <span style="color: teal;">Spalte3</span><span style="color: gray;">)</span></span></span></p>
<p>Aber der Ausdruck darf nicht mehr als eine Zeile und Spalte zurückgeben (skalarer Ausdruck). Mit einem kleinen Trick kann man aber trotzdem mehrere Werte übergeben. Dazu ein Beispiel mit Testdaten:</p>
<p><span style="font-family: courier new,courier;"><span style="font-size: 10pt; color: blue;" lang="EN-US">begin</span><span style="font-size: 10pt;" lang="EN-US"> <span style="color: blue;">try</span> <span style="color: blue;">drop</span> <span style="color: blue;">table</span> <span style="color: teal;">#t</span> <span style="color: blue;">end</span> <span style="color: blue;">try</span> <span style="color: blue;">begin</span> <span style="color: blue;">catch</span> <span style="color: blue;">end</span> <span style="color: blue;">catch</span><span style="color: gray;">;</span></span></span></p>
<p><span style="font-family: courier new,courier;"><span style="font-size: 10pt; color: gray;" lang="EN-US"> </span></span></p>
<p><span style="font-family: courier new,courier;"><span style="font-size: 10pt; color: blue;" lang="EN-US">select</span><span style="font-size: 10pt;" lang="EN-US"> </span></span></p>
<p style="padding-left: 30px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt;" lang="EN-US"><span style="color: blue;">identity</span><span style="color: gray;">(</span><span style="color: blue;">int</span><span style="color: gray;">,</span> 1<span style="color: gray;">,</span> 1<span style="color: gray;">)</span> <span style="color: teal;">id</span><span style="color: gray;">,</span></span></span></p>
<p style="padding-left: 30px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt;" lang="EN-US"><span style="color: gray;">*</span></span></span></p>
<p><span style="font-family: courier new,courier;"><span style="font-size: 10pt; color: blue;" lang="EN-US">into</span><span style="font-size: 10pt;" lang="EN-US"> <span style="color: teal;">#t</span></span></span></p>
<p><span style="font-family: courier new,courier;"><span style="font-size: 10pt; color: blue;" lang="EN-US">from</span></span></p>
<p><span style="font-family: courier new,courier;"><span style="font-size: 10pt; color: gray;" lang="EN-US">(</span></span></p>
<p><span style="font-family: courier new,courier;"><span style="font-size: 10pt;" lang="EN-US"> <span style="color: blue;">values</span></span></span></p>
<p style="padding-left: 30px;"><span style="color: #000000;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt;" lang="EN-US"> </span><span style="font-size: 10pt;" lang="EN-US">(</span><span style="font-size: 10pt;" lang="EN-US">0,0,0,0,0,0), </span><span style="font-size: 10pt;" lang="EN-US">(</span><span style="font-size: 10pt;" lang="EN-US">1,0,0,0,0,0), </span><span style="font-size: 10pt;" lang="EN-US">(</span><span style="font-size: 10pt;" lang="EN-US">0,1,0,0,0,0),</span></span></span></p>
<p style="padding-left: 30px;"><span style="color: #000000;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt;" lang="EN-US"> </span><span style="font-size: 10pt;" lang="EN-US">(</span><span style="font-size: 10pt;" lang="EN-US">0,0,1,0,0,0), </span><span style="font-size: 10pt;" lang="EN-US">(</span><span style="font-size: 10pt;" lang="EN-US">0,0,0,1,0,0), </span><span style="font-size: 10pt;" lang="EN-US">(</span><span style="font-size: 10pt;" lang="EN-US">0,0,0,0,1,0),</span></span></span></p>
<p style="padding-left: 30px;"><span style="color: #000000;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt;" lang="EN-US"> </span><span style="font-size: 10pt;" lang="EN-US">(</span><span style="font-size: 10pt;" lang="EN-US">0,0,0,0,0,1), </span><span style="font-size: 10pt;" lang="EN-US">(</span><span style="font-size: 10pt;" lang="EN-US">2,0,0,0,0,0), </span><span style="font-size: 10pt;" lang="EN-US">(</span><span style="font-size: 10pt;" lang="EN-US">0,2,0,0,0,0),</span></span></span></p>
<p style="padding-left: 30px;"><span style="color: #000000;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt;" lang="EN-US"> </span><span style="font-size: 10pt;" lang="EN-US">(</span><span style="font-size: 10pt;" lang="EN-US">0,0,2,0,0,0), </span><span style="font-size: 10pt;" lang="EN-US">(</span><span style="font-size: 10pt;" lang="EN-US">0,0,0,2,0,0), </span><span style="font-size: 10pt;" lang="EN-US">(</span><span style="font-size: 10pt;" lang="EN-US">0,0,0,0,2,0),</span></span></span></p>
<p style="padding-left: 30px;"><span style="color: #000000;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt;" lang="EN-US"> </span><span style="font-size: 10pt;" lang="EN-US">(</span><span style="font-size: 10pt;" lang="EN-US">0,0,0,0,0,2), </span><span style="font-size: 10pt;" lang="EN-US">(</span><span style="font-size: 10pt;" lang="EN-US">3,0,0,0,0,0), </span><span style="font-size: 10pt;" lang="EN-US">(</span><span style="font-size: 10pt;" lang="EN-US">0,3,0,0,0,0),</span></span></span></p>
<p style="padding-left: 30px;"><span style="color: #000000;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt;" lang="EN-US"> </span><span style="font-size: 10pt;" lang="EN-US">(</span><span style="font-size: 10pt;" lang="EN-US">0,0,3,0,0,0), </span><span style="font-size: 10pt;" lang="EN-US">(</span><span style="font-size: 10pt;" lang="EN-US">0,0,0,3,0,0), </span><span style="font-size: 10pt;" lang="EN-US">(</span><span style="font-size: 10pt;" lang="EN-US">0,0,0,0,3,0),</span></span></span></p>
<p style="padding-left: 30px;"><span style="color: #000000;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt;" lang="EN-US"> </span><span style="font-size: 10pt;" lang="EN-US">(</span><span style="font-size: 10pt;" lang="EN-US">0,0,0,0,0,3)</span></span></span></p>
<p><span style="font-family: courier new,courier;"><span style="font-size: 10pt; color: gray;" lang="EN-US">)</span></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-US"><span style="font-family: courier new,courier;"> <span style="color: teal;">t</span><span style="color: gray;">(</span><span style="color: teal;">sp1</span><span style="color: gray;">,</span> <span style="color: teal;">sp2</span><span style="color: gray;">,</span> <span style="color: teal;">sp3</span><span style="color: gray;">,</span> <span style="color: teal;">sp4</span><span style="color: gray;">,</span> <span style="color: teal;">sp5</span><span style="color: gray;">,</span> <span style="color: teal;">sp6</span></span><span style="color: gray;"><span style="font-family: courier new,courier;">);</span></span></span></p>
<p> </p>
<p>Ein Crossjoin mit den zu überprüfenden Werten funktioniert:</p>
<p> </p>
<p><span style="font-family: courier new,courier;"><span style="font-size: 10pt; color: blue;" lang="EN-US">select</span><span style="font-size: 10pt;" lang="EN-US"> <span style="color: blue;">distinct</span><span style="color: teal;"> id</span></span></span></p>
<p><span style="font-family: courier new,courier;"><span style="font-size: 10pt; color: blue;" lang="EN-US">from</span><span style="font-size: 10pt;" lang="EN-US"> <span style="color: teal;">#t</span><span style="color: gray;">,</span></span></span></p>
<p><span style="font-family: courier new,courier;"><span style="font-size: 10pt; color: gray;" lang="EN-US">(</span></span></p>
<p style="padding-left: 30px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt;" lang="EN-US"><span style="color: blue;">select</span> <span style="color: teal;">arg</span></span></span></p>
<p style="padding-left: 30px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt;" lang="EN-US"><span style="color: blue;">from </span><span style="color: gray;">(</span><span style="color: blue;">values </span><span style="color: gray;">(</span>1<span style="color: gray;">),</span><span style="color: blue;"> </span><span style="color: gray;">(</span>2<span style="color: gray;">))</span> <span style="color: teal;">a</span><span style="color: gray;">(</span><span style="color: teal;">arg</span><span style="color: gray;">)</span></span></span></p>
<p><span style="font-family: courier new,courier;"><span style="font-size: 10pt; color: gray;" lang="EN-US">)</span><span style="font-size: 10pt;" lang="EN-US"> <span style="color: teal;">t</span></span></span></p>
<p><span style="font-family: courier new,courier;"><span style="font-size: 10pt; color: blue;" lang="EN-US">where</span></span></p>
<p style="padding-left: 30px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt;" lang="EN-US"><span style="color: teal;">arg</span> <span style="color: gray;">in</span><span style="color: blue;"> </span><span style="color: gray;">(</span><span style="color: teal;">sp1</span><span style="color: gray;">,</span> <span style="color: teal;">sp2</span><span style="color: gray;">,</span> <span style="color: teal;">sp3</span><span style="color: gray;">,</span> <span style="color: teal;">sp4</span><span style="color: gray;">,</span> <span style="color: teal;">sp5</span><span style="color: gray;">,</span> <span style="color: teal;">sp6</span><span style="color: gray;">);</span></span></span></p>
<p> </p>
<p>Noch ein anderes Beispiel, mit dem man alle Lottozahlen 6 aus 49 inkl. Zusatzzahl erzeugen kann (vielleicht weiß ja jemand, wie man damit den Jackpot knacken kann ;-) )</p>
<p><span style="font-family: courier new,courier;"><span style="font-size: 10pt; color: blue;" lang="EN-US">;with</span><span style="font-size: 10pt;" lang="EN-US"> <span style="color: teal;">n</span> <span style="color: blue;">as</span></span></span></p>
<p><span style="font-family: courier new,courier;"><span style="font-size: 10pt; color: gray;" lang="EN-US">(</span></span></p>
<p style="padding-left: 30px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt;" lang="EN-US"><span style="color: blue;">select</span> 1 <span style="color: teal;">n</span></span></span></p>
<p style="padding-left: 30px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt;" lang="EN-US"> </span></span></p>
<p style="padding-left: 30px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt;" lang="EN-US"><span style="color: blue;">union</span> <span style="color: gray;">all</span></span></span></p>
<p style="padding-left: 30px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt;" lang="EN-US"> </span></span></p>
<p style="padding-left: 30px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt;" lang="EN-US"><span style="color: blue;">select</span> <span style="color: teal;">n</span> <span style="color: gray;">+</span> 1</span></span></p>
<p style="padding-left: 30px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt;" lang="EN-US"><span style="color: blue;">from</span> <span style="color: teal;">n</span></span></span></p>
<p style="padding-left: 30px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt;" lang="EN-US"> <span style="color: blue;">where</span></span></span></p>
<p style="padding-left: 60px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt;" lang="EN-US"><span style="color: teal;">n</span> <span style="color: gray;">&lt;</span> 49</span></span></p>
<p><span style="font-family: courier new,courier;"><span style="font-size: 10pt; color: gray;" lang="EN-US">),</span></span></p>
<p><span style="font-family: courier new,courier;"><span style="font-size: 10pt; color: teal;" lang="EN-US">z</span><span style="font-size: 10pt;" lang="EN-US"> <span style="color: blue;">as</span></span></span></p>
<p><span style="font-family: courier new,courier;"><span style="font-size: 10pt; color: gray;" lang="EN-US">(</span></span></p>
<p style="padding-left: 30px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt;" lang="EN-US"><span style="color: blue;">select</span> 1 <span style="color: teal;">z</span></span></span></p>
<p style="padding-left: 30px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt;" lang="EN-US"> </span></span></p>
<p style="padding-left: 30px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt;" lang="EN-US"><span style="color: blue;">union</span> <span style="color: gray;">all</span></span></span></p>
<p style="padding-left: 30px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt;" lang="EN-US"> </span></span></p>
<p style="padding-left: 30px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt;" lang="EN-US"><span style="color: blue;">select</span> <span style="color: teal;">z</span> <span style="color: gray;">+</span> 1</span></span></p>
<p style="padding-left: 30px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt;" lang="EN-US"><span style="color: blue;">from</span> <span style="color: teal;">z</span></span></span></p>
<p style="padding-left: 30px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt;" lang="EN-US"><span style="color: blue;">where</span></span></span></p>
<p style="padding-left: 60px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt;" lang="EN-US"><span style="color: teal;">z</span> <span style="color: gray;">&lt;</span> 10</span></span></p>
<p><span style="font-family: courier new,courier;"><span style="font-size: 10pt; color: gray;" lang="EN-US">)</span></span></p>
<p><span style="font-family: courier new,courier;"><span style="font-size: 10pt; color: gray;" lang="EN-US">,</span><span style="font-size: 10pt; color: teal;" lang="EN-US">lotto</span><span style="font-size: 10pt;" lang="EN-US"> <span style="color: blue;">as</span></span></span></p>
<p><span style="font-family: courier new,courier;"><span style="font-size: 10pt; color: gray;" lang="EN-US">(</span></span></p>
<p style="padding-left: 30px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt;" lang="EN-US"><span style="color: blue;">select</span></span></span></p>
<p style="padding-left: 60px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt;" lang="EN-US"><span style="color: teal;">n1</span><span style="color: gray;">.</span><span style="color: teal;">n</span> <span style="color: blue;">as</span> <span style="color: teal;">Zahl_1</span><span style="color: gray;">,</span></span></span></p>
<p style="padding-left: 60px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt; color: teal;">n2</span><span style="font-size: 10pt; color: gray;">.</span><span style="font-size: 10pt; color: teal;">n</span><span style="font-size: 10pt;"> <span style="color: blue;">as</span> <span style="color: teal;">Zahl_2</span><span style="color: gray;">,</span></span></span></p>
<p style="padding-left: 60px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt;"><span style="color: teal;">n3</span><span style="color: gray;">.</span><span style="color: teal;">n</span> <span style="color: blue;">as</span> <span style="color: teal;">Zahl_3</span><span style="color: gray;">,</span></span></span></p>
<p style="padding-left: 60px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt;"><span style="color: teal;">n4</span><span style="color: gray;">.</span><span style="color: teal;">n</span> <span style="color: blue;">as</span> <span style="color: teal;">Zahl_4</span><span style="color: gray;">,</span></span></span></p>
<p style="padding-left: 60px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt;"><span style="color: teal;">n5</span><span style="color: gray;">.</span><span style="color: teal;">n</span> <span style="color: blue;">as</span> <span style="color: teal;">Zahl_5</span><span style="color: gray;">,</span></span></span></p>
<p style="padding-left: 60px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt;"><span style="color: teal;">n6</span><span style="color: gray;">.</span><span style="color: teal;">n</span> <span style="color: blue;">as</span> <span style="color: teal;">Zahl_6</span><span style="color: gray;">,</span></span></span></p>
<p style="padding-left: 60px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt;"><span style="color: teal;">z</span><span style="color: gray;">.</span><span style="color: teal;">z</span> <span style="color: blue;">as</span> <span style="color: teal;">Zusatzzahl</span></span></span></p>
<p style="padding-left: 30px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt;"><span style="color: blue;">from</span> <span style="color: teal;">n</span> <span style="color: teal;">n1</span><span style="color: gray;">,</span> <span style="color: teal;">n</span> <span style="color: teal;">n2</span><span style="color: gray;">,</span> <span style="color: teal;">n</span> <span style="color: teal;">n3</span><span style="color: gray;">,</span> <span style="color: teal;">n</span> <span style="color: teal;">n4</span><span style="color: gray;">,</span> <span style="color: teal;">n</span> <span style="color: teal;">n5</span><span style="color: gray;">,</span> <span style="color: teal;">n</span> <span style="color: teal;">n6</span><span style="color: gray;">,</span> <span style="color: teal;">z</span></span></span></p>
<p style="padding-left: 30px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt; color: blue;" lang="EN-US">where</span><span style="font-size: 10pt;" lang="EN-US"> </span></span></p>
<p style="padding-left: 60px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt;" lang="EN-US"><span style="color: teal;">n1</span><span style="color: gray;">.</span><span style="color: teal;">n</span> <span style="color: gray;">not</span> <span style="color: gray;">in</span><span style="color: blue;"> </span><span style="color: gray;">(</span><span style="color: teal;">n2</span><span style="color: gray;">.</span><span style="color: teal;">n</span><span style="color: gray;">,</span> <span style="color: teal;">n3</span><span style="color: gray;">.</span><span style="color: teal;">n</span><span style="color: gray;">,</span> <span style="color: teal;">n4</span><span style="color: gray;">.</span><span style="color: teal;">n</span><span style="color: gray;">,</span> <span style="color: teal;">n5</span><span style="color: gray;">.</span><span style="color: teal;">n</span><span style="color: gray;">,</span> <span style="color: teal;">n6</span><span style="color: gray;">.</span><span style="color: teal;">n</span><span style="color: gray;">)</span> <span style="color: gray;">and</span></span></span></p>
<p style="padding-left: 60px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt;" lang="EN-US"><span style="color: teal;">n2</span><span style="color: gray;">.</span><span style="color: teal;">n</span> <span style="color: gray;">not</span> <span style="color: gray;">in</span><span style="color: blue;"> </span><span style="color: gray;">(</span><span style="color: teal;">n1</span><span style="color: gray;">.</span><span style="color: teal;">n</span><span style="color: gray;">,</span> <span style="color: teal;">n3</span><span style="color: gray;">.</span><span style="color: teal;">n</span><span style="color: gray;">,</span> <span style="color: teal;">n4</span><span style="color: gray;">.</span><span style="color: teal;">n</span><span style="color: gray;">,</span> <span style="color: teal;">n5</span><span style="color: gray;">.</span><span style="color: teal;">n</span><span style="color: gray;">,</span> <span style="color: teal;">n6</span><span style="color: gray;">.</span><span style="color: teal;">n</span><span style="color: gray;">)</span> <span style="color: gray;">and</span></span></span></p>
<p style="padding-left: 60px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt;" lang="EN-US"><span style="color: teal;">n3</span><span style="color: gray;">.</span><span style="color: teal;">n</span> <span style="color: gray;">not</span> <span style="color: gray;">in</span><span style="color: blue;"> </span><span style="color: gray;">(</span><span style="color: teal;">n1</span><span style="color: gray;">.</span><span style="color: teal;">n</span><span style="color: gray;">,</span> <span style="color: teal;">n2</span><span style="color: gray;">.</span><span style="color: teal;">n</span><span style="color: gray;">,</span> <span style="color: teal;">n4</span><span style="color: gray;">.</span><span style="color: teal;">n</span><span style="color: gray;">,</span> <span style="color: teal;">n5</span><span style="color: gray;">.</span><span style="color: teal;">n</span><span style="color: gray;">,</span> <span style="color: teal;">n6</span><span style="color: gray;">.</span><span style="color: teal;">n</span><span style="color: gray;">)</span> <span style="color: gray;">and</span></span></span></p>
<p style="padding-left: 60px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt;" lang="EN-US"><span style="color: teal;">n4</span><span style="color: gray;">.</span><span style="color: teal;">n</span> <span style="color: gray;">not</span> <span style="color: gray;">in</span><span style="color: blue;"> </span><span style="color: gray;">(</span><span style="color: teal;">n1</span><span style="color: gray;">.</span><span style="color: teal;">n</span><span style="color: gray;">,</span> <span style="color: teal;">n2</span><span style="color: gray;">.</span><span style="color: teal;">n</span><span style="color: gray;">,</span> <span style="color: teal;">n3</span><span style="color: gray;">.</span><span style="color: teal;">n</span><span style="color: gray;">,</span> <span style="color: teal;">n5</span><span style="color: gray;">.</span><span style="color: teal;">n</span><span style="color: gray;">,</span> <span style="color: teal;">n6</span><span style="color: gray;">.</span><span style="color: teal;">n</span><span style="color: gray;">)</span> <span style="color: gray;">and</span></span></span></p>
<p style="padding-left: 60px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt;" lang="EN-US"><span style="color: teal;">n5</span><span style="color: gray;">.</span><span style="color: teal;">n</span> <span style="color: gray;">not</span> <span style="color: gray;">in</span><span style="color: blue;"> </span><span style="color: gray;">(</span><span style="color: teal;">n1</span><span style="color: gray;">.</span><span style="color: teal;">n</span><span style="color: gray;">,</span> <span style="color: teal;">n2</span><span style="color: gray;">.</span><span style="color: teal;">n</span><span style="color: gray;">,</span> <span style="color: teal;">n3</span><span style="color: gray;">.</span><span style="color: teal;">n</span><span style="color: gray;">,</span> <span style="color: teal;">n4</span><span style="color: gray;">.</span><span style="color: teal;">n</span><span style="color: gray;">,</span> <span style="color: teal;">n6</span><span style="color: gray;">.</span><span style="color: teal;">n</span><span style="color: gray;">)</span> <span style="color: gray;">and</span></span></span></p>
<p style="padding-left: 60px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt;" lang="EN-US"><span style="color: teal;">n6</span><span style="color: gray;">.</span><span style="color: teal;">n</span> <span style="color: gray;">not</span> <span style="color: gray;">in</span><span style="color: blue;"> </span><span style="color: gray;">(</span><span style="color: teal;">n1</span><span style="color: gray;">.</span><span style="color: teal;">n</span><span style="color: gray;">,</span> <span style="color: teal;">n2</span><span style="color: gray;">.</span><span style="color: teal;">n</span><span style="color: gray;">,</span> <span style="color: teal;">n3</span><span style="color: gray;">.</span><span style="color: teal;">n</span><span style="color: gray;">,</span> <span style="color: teal;">n4</span><span style="color: gray;">.</span><span style="color: teal;">n</span><span style="color: gray;">,</span> <span style="color: teal;">n5</span><span style="color: gray;">.</span><span style="color: teal;">n</span><span style="color: gray;">)</span> <span style="color: gray;">and</span></span></span></p>
<p style="padding-left: 60px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt;" lang="EN-US"><span style="color: teal;">n2</span><span style="color: gray;">.</span><span style="color: teal;">n</span> <span style="color: gray;">&gt;</span> <span style="color: teal;">n1</span><span style="color: gray;">.</span><span style="color: teal;">n</span> <span style="color: gray;">and</span></span></span></p>
<p style="padding-left: 60px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt;" lang="EN-US"><span style="color: teal;">n3</span><span style="color: gray;">.</span><span style="color: teal;">n</span> <span style="color: gray;">&gt;</span> <span style="color: teal;">n2</span><span style="color: gray;">.</span><span style="color: teal;">n</span> <span style="color: gray;">and</span></span></span></p>
<p style="padding-left: 60px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt;" lang="EN-US"><span style="color: teal;">n4</span><span style="color: gray;">.</span><span style="color: teal;">n</span> <span style="color: gray;">&gt;</span> <span style="color: teal;">n3</span><span style="color: gray;">.</span><span style="color: teal;">n</span> <span style="color: gray;">and</span></span></span></p>
<p style="padding-left: 60px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt;" lang="EN-US"><span style="color: teal;">n5</span><span style="color: gray;">.</span><span style="color: teal;">n</span> <span style="color: gray;">&gt;</span> <span style="color: teal;">n4</span><span style="color: gray;">.</span><span style="color: teal;">n</span> <span style="color: gray;">and</span></span></span></p>
<p style="padding-left: 60px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt;" lang="EN-US"><span style="color: teal;">n6</span><span style="color: gray;">.</span><span style="color: teal;">n</span> <span style="color: gray;">&gt;</span> <span style="color: teal;">n5</span><span style="color: gray;">.</span><span style="color: teal;">n</span></span></span></p>
<p><span style="font-family: courier new,courier;"><span style="font-size: 10pt; color: gray;" lang="EN-US">)</span></span></p>
<p><span style="font-family: courier new,courier;"><span style="font-size: 10pt; color: blue;" lang="EN-US">select</span><span style="font-size: 10pt;" lang="EN-US"> <span style="color: blue;">top</span><span style="color: gray;">(</span>1<span style="color: gray;">)</span> <span style="color: gray;">*</span></span><span style="font-size: 10pt; color: green;" lang="EN-US"> </span><span style="font-size: 10pt; color: green;">-- aus 139838160 Zeilen</span></span></p>
<p><span style="font-family: courier new,courier;"><span style="font-size: 10pt; color: blue;" lang="EN-US">from</span><span style="font-size: 10pt;" lang="EN-US"> <span style="color: teal;">lotto</span></span></span></p>
<p><span style="font-family: courier new,courier;"><span style="font-size: 10pt; color: blue;" lang="EN-US">order</span><span style="font-size: 10pt;" lang="EN-US"> <span style="color: blue;">by</span></span></span></p>
<p style="padding-left: 30px;"><span style="font-family: courier new,courier;"><span style="font-size: 10pt; color: fuchsia;" lang="EN-US">newid</span><span style="font-size: 10pt; color: gray;" lang="EN-US">();</span></span></p>
<p>Viele Grüße</p>
<p>Christoph Ingenhaag</p>]]></content:encoded>
								<comments>https://www.insidesql.org/blogs/christoph_ingenhaag/2010/08/17/in_in_ist_mehr_drin#comments</comments>
			<wfw:commentRss>https://www.insidesql.org/blogs/christoph_ingenhaag/?tempskin=_rss2&#38;disp=comments&#38;p=931</wfw:commentRss>
		</item>
			</channel>
</rss>
