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

<channel>
	<title>Le blog de SQLpro &#187; génération</title>
	<atom:link href="https://blog.developpez.com/sqlpro/ptag/generation/feed" rel="self" type="application/rss+xml" />
	<link>https://blog.developpez.com/sqlpro</link>
	<description>Le SQL pour SQL Server, PostGreSQL et tous les autres SGBDR</description>
	<lastBuildDate>Thu, 15 Oct 2020 12:59:17 +0000</lastBuildDate>
	<language>fr-FR</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=4.1.42</generator>
	<item>
		<title>Génération d&#8217;un &#171;&#160;rétro script&#160;&#187; d&#8217;insertion</title>
		<link>https://blog.developpez.com/sqlpro/p13126/ms-sql-server/sql-server-2012/generation-dun-retro-script-dinsertion</link>
		<comments>https://blog.developpez.com/sqlpro/p13126/ms-sql-server/sql-server-2012/generation-dun-retro-script-dinsertion#comments</comments>
		<pubDate>Wed, 11 Jan 2017 15:11:22 +0000</pubDate>
		<dc:creator><![CDATA[SQLpro]]></dc:creator>
				<category><![CDATA[SQL Server 2012]]></category>
		<category><![CDATA[SQL Server 2014]]></category>
		<category><![CDATA[SQL Server 2016]]></category>
		<category><![CDATA[génération]]></category>
		<category><![CDATA[INSERT]]></category>
		<category><![CDATA[jeu de données]]></category>
		<category><![CDATA[rétro script]]></category>
		<category><![CDATA[SQL server]]></category>

		<guid isPermaLink="false">http://blog.developpez.com/sqlpro/?p=716</guid>
		<description><![CDATA[Il est souvent intéressant de générer les commande &#171;&#160;INSERT&#160;&#187; relatives aux lignes d&#8217;une table existante, ceci par exemple afin de procéder à des essais, des tests ou encore pour illustrer des posts sur developpez.com ou d&#8217;autres forums afin de faciliter ceux qui tente de vous répondre avec de vraies données. La procédure qui est publiée [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>Il est souvent intéressant de générer les commande &laquo;&nbsp;INSERT&nbsp;&raquo; relatives aux lignes d&rsquo;une table existante, ceci par exemple afin de procéder à des essais, des tests ou encore pour illustrer des posts sur developpez.com ou d&rsquo;autres forums afin de faciliter ceux qui tente de vous répondre avec de vraies données. La procédure qui est publiée ci-dessous permet de générer ces lignes d&rsquo;insertion depuis n&rsquo;importe quelle base de votre instance SQL Server.<br />
<span id="more-716"></span><br />
Le principe est simple : faire générer par SQL Server des scripts SQL de rétro-insertion des données, sous forme d&rsquo;ordre SQL de type INSERT INTO.<br />
Le format de sortie est du texte UNICODE explicite sauf les &laquo;&nbsp;LOBs&nbsp;&raquo; pour lesquels les valeurs sont sous forme binaires (varchar(max), nvarchar(max), varbinary(max), text, ntext, image, xml, geometry, geography, sql_variant, hierarchyid&#8230;).</p>
<p><strong>PARAMÈTRES</strong></p>
<p>@SCH et @TBL sont les paramètres devant faire référence au schéma SQL de la table (par défaut dbo) et au nom de la table elle même.</p>
<p>Différents paramètres permettent de régler les problématiques suivantes :</p>
<p><strong>Nombre de lignes :</strong></p>
<li>@LIMIT : valeurs stricte entière limitant le nombre de lignes (doit être NULL ou &gt; 0). par défaut = 1000.</li>
<li>@TABLESAMPLE_PC : échantillon approximatif et aléatoire en nombre de ligne pour une grande tables.</li>
<p>Les deux pouvant être combinés.</p>
<p><strong>Prise en compte de certaines colonnes :</strong></p>
<li>@KEEP_ID : si 1 alors il y a conservation des auto incréments.</li>
<li>@KEEP_LOBS : si 1 alors il y a conservation des &laquo;&nbsp;LOBs&nbsp;&raquo; dont les valeurs sont générées sous forme binaire (hexadécimale).</li>
<p>Les deux pouvant être spécifiées</p>
<p><strong>Clauses de la requête :</strong></p>
<li>@WHERE : contenu de la clause WHERE de restriction des lignes, telle que pouvant figurer dans une requête SELECT * sur la table.</li>
<li>@ORDER_BY : contenu de la clause ORDER BY de tri des lignes, telle que pouvant figurer dans une requête SELECT * sur la table.</li>
<li>@ALEA : si 1, tri aléatoire des données de la table</li>
<p>Les clauses WHERE et ORDER BY peuvent être spécifiée toutes les deux, mais <strong>vous ne pouvez pas spécifier simultanément un contenu pour le paramètre @ORDER_BY et une valeur de 1 pour le paramètre @ALEA, il faut choisir soit un tri aléatoire soit un tri spécifique.</strong></p>
<p><strong>Paramètres d&rsquo;exécution :</strong></p>
<li>@NOLOCK : lite les données sans se préoccuper du verrouillage (idéal pour les jeux de données)</li>
<li>@DEBUG : si 1, renvoi des jeux de résultats intermédiaires pour le débogage</li>
<p>Les deux pouvant êtres spécifiés.</p>
<p><strong>LA PROCÉDURE</strong></p>
<div class="codecolorer-container sql default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><div class="sql codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">PROCEDURE</span> dbo<span style="color: #66cc66;">.</span>sp__GENERATE_INSERT <br />
&nbsp; &nbsp;@SCH &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;sysname <span style="color: #66cc66;">=</span> <span style="color: #ff0000;">'dbo'</span><span style="color: #66cc66;">,</span> &nbsp; <span style="color: #808080; font-style: italic;">-- schema de la table visée</span><br />
&nbsp; &nbsp;@TBL &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;sysname<span style="color: #66cc66;">,</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">-- nom de la table visée</span><br />
&nbsp; &nbsp;@KEEP_ID &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;BIT <span style="color: #66cc66;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #66cc66;">,</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">-- conservation des auto incréments</span><br />
&nbsp; &nbsp;@KEEP_LOBS &nbsp; &nbsp; &nbsp; &nbsp;BIT <span style="color: #66cc66;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">,</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">-- ne pas prendre en compte les &quot;LOBs&quot;</span><br />
&nbsp; &nbsp;@<span style="color: #993333; font-weight: bold;">LIMIT</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #993333; font-weight: bold;">INT</span> <span style="color: #66cc66;">=</span> <span style="color: #cc66cc;">1000</span><span style="color: #66cc66;">,</span> &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #808080; font-style: italic;">-- limite en nombre de lignes</span><br />
&nbsp; &nbsp;@TABLESAMPLE_PC &nbsp; <span style="color: #993333; font-weight: bold;">FLOAT</span> <span style="color: #66cc66;">=</span> <span style="color: #993333; font-weight: bold;">NULL</span><span style="color: #66cc66;">,</span> &nbsp; &nbsp; &nbsp;<span style="color: #808080; font-style: italic;">-- échantillon en pourcentage</span><br />
&nbsp; &nbsp;@<span style="color: #993333; font-weight: bold;">WHERE</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;NVARCHAR<span style="color: #66cc66;">&#40;</span><span style="color: #993333; font-weight: bold;">MAX</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">=</span> <span style="color: #ff0000;">''</span><span style="color: #66cc66;">,</span><span style="color: #808080; font-style: italic;">-- clause WHERE de la requête</span><br />
&nbsp; &nbsp;@ORDER_BY &nbsp; &nbsp; &nbsp; &nbsp; NVARCHAR<span style="color: #66cc66;">&#40;</span><span style="color: #993333; font-weight: bold;">MAX</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">=</span> <span style="color: #ff0000;">''</span><span style="color: #66cc66;">,</span><span style="color: #808080; font-style: italic;">-- clause ORDER BY de la requête</span><br />
&nbsp; &nbsp;@ALEA &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; BIT <span style="color: #66cc66;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">,</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">-- valeur dans un ordre aléatoire </span><br />
&nbsp; &nbsp;@NOLOCK &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; BIT <span style="color: #66cc66;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #66cc66;">,</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">-- lecture sale</span><br />
&nbsp; &nbsp;@DEBUG &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;BIT <span style="color: #66cc66;">=</span> <span style="color: #cc66cc;">0</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #808080; font-style: italic;">-- informations de débogage</span><br />
<span style="color: #993333; font-weight: bold;">AS</span><br />
<span style="color: #808080; font-style: italic;">/******************************************************************************<br />
* GÉNÉRATION D'INSERT SQL &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; *<br />
* Procédure générant un rétro-script d'insertion de lignes d'une table &nbsp; &nbsp; &nbsp; &nbsp;*<br />
******************************************************************************* &nbsp; <br />
* Frédéric Brouard - SQLpro@SQLspot.com - Sté SQL SPOT http://www.sqlspot.com *<br />
* Plus d'info. sur http://sqlpro.developpez.com &nbsp; - &nbsp;2017-01-11 - version 1.0 * &nbsp; <br />
******************************************************************************* &nbsp; <br />
* Cette procédure prend en argument le nom d'une table et son schéma SQL, &nbsp; &nbsp; *<br />
* ainsi que divers paramètres de limitation des colonnes et des lignes, &nbsp; &nbsp; &nbsp; *<br />
* et ordre des données ainsi que des paramètres d'exécution &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; *<br />
* LIMITATION : ne prends en compte que les tables ou vues utilisateur &nbsp; &nbsp; &nbsp; &nbsp; *<br />
*******************************************************************************<br />
* ATTENTION &nbsp;: procédure système ! Exécutable depuis n'importe quelle base &nbsp; &nbsp;*<br />
* &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; *<br />
* Paramètre en entrée : mot partiel dont on cherche au moins une racine &nbsp; &nbsp; &nbsp; *<br />
* &nbsp; @SCH &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;sysname &nbsp; &nbsp; &nbsp; &nbsp; schema SQL de la table (dbo par défaut) *<br />
* &nbsp; @TBL &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;sysname, &nbsp; &nbsp; &nbsp; &nbsp;nom de la table visée par le script &nbsp; &nbsp; *<br />
* &nbsp; @LIMIT &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;INT &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; limite du nombre de lignes retournées &nbsp; *<br />
* &nbsp; @KEEP_ID &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;BIT &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; si 1 conserve la colonne IDENTITY &nbsp; &nbsp; &nbsp; *<br />
* &nbsp; @ALEA &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; BIT &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; si 1, valeurs dans un ordre aléatoire &nbsp; *<br />
* &nbsp; @TABLESAMPLE_PC &nbsp; FLOAT &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; échantillon approximatif en pourcentage *<br />
* &nbsp; @ORDER_BY &nbsp; &nbsp; &nbsp; &nbsp; NVARCHAR(max) &nbsp; clause ORDER BY de la requête &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; *<br />
* &nbsp; @WHERE &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;NVARCHAR(max) &nbsp; clause WHERE de la requête &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*<br />
* &nbsp; @NOLOCK &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; BIT &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; lecture sale (ignore les verrous) &nbsp; &nbsp; &nbsp; *<br />
* &nbsp; @KEEP_LOBS &nbsp; &nbsp; &nbsp; &nbsp;BIT &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; si 0 ne pas prendre en compte les &quot;LOBs&quot;*<br />
* &nbsp; @DEBUG &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;BIT &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; si 1 ajouter information de débogage &nbsp; &nbsp;*<br />
* &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; *<br />
* NOTA : seule le paramètre TBL est obligatoire &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; *<br />
* &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; *<br />
* EXEMPLE : &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; *<br />
* EXEC dbo.sp__GENERATE_INSERT &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*<br />
* &nbsp; &nbsp;@SCH &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;= 'dbo', &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; *<br />
* &nbsp; &nbsp;@TBL &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;= 'customers', &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; *<br />
* &nbsp; &nbsp;@LIMIT &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;= 100, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; *<br />
* &nbsp; &nbsp;@KEEP_ID &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;= 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; * <br />
* &nbsp; &nbsp;@ALEA &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = 1, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; *<br />
* &nbsp; &nbsp;@TABLESAMPLE_PC &nbsp; = NULL, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*<br />
* &nbsp; &nbsp;@ORDER_BY &nbsp; &nbsp; &nbsp; &nbsp; = NULL, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*<br />
* &nbsp; &nbsp;@WHERE &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;= 'date_create &gt; ''2016-01-01''', &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*<br />
* &nbsp; &nbsp;@NOLOCK &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = 1, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; *<br />
* &nbsp; &nbsp;@KEEP_LOBS &nbsp; &nbsp; &nbsp; &nbsp;= 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; *<br />
* &nbsp; &nbsp;@DEBUG &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;= 0 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*<br />
* Résultats : &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; *<br />
* &nbsp; &nbsp;INSERT INTO dbo.customers ( .... ) VALUES ( ... ); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; *<br />
* &nbsp; &nbsp;INSERT INTO dbo.customers ( .... ) VALUES ( ... ); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; *<br />
* &nbsp; &nbsp;INSERT INTO dbo.customers ( .... ) VALUES ( ... ); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; *<br />
* &nbsp; &nbsp;... &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* <br />
<br />
******************************************************************************/</span> <br />
<span style="color: #993333; font-weight: bold;">BEGIN</span><br />
<br />
<span style="color: #993333; font-weight: bold;">SET</span> NOCOUNT <span style="color: #993333; font-weight: bold;">ON</span>;<br />
<br />
<span style="color: #993333; font-weight: bold;">DECLARE</span> @IS_VIEW &nbsp; &nbsp; &nbsp; &nbsp;BIT<span style="color: #66cc66;">,</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">-- la table est une vue</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; @HAS_IDENTITY &nbsp; BIT<span style="color: #66cc66;">,</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">-- table avec colonne IDENTITY</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; @OID &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #993333; font-weight: bold;">INT</span><span style="color: #66cc66;">,</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">-- object_id de la table</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; @COL_IDENTITY &nbsp; NVARCHAR<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">128</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span> &nbsp; <span style="color: #808080; font-style: italic;">-- nom colonne IDENTITY &nbsp;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; @COLS &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; NVARCHAR<span style="color: #66cc66;">&#40;</span><span style="color: #993333; font-weight: bold;">MAX</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span> &nbsp; <span style="color: #808080; font-style: italic;">-- liste des colonnes de la table</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; @<span style="color: #993333; font-weight: bold;">SQL</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;NVARCHAR<span style="color: #66cc66;">&#40;</span><span style="color: #993333; font-weight: bold;">MAX</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span> &nbsp; <span style="color: #808080; font-style: italic;">-- requête SQL dynamique</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; @O_NAME &nbsp; &nbsp; &nbsp; &nbsp; NVARCHAR<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">261</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span> &nbsp; <span style="color: #808080; font-style: italic;">-- nom complet de la table </span><br />
&nbsp; &nbsp; &nbsp; &nbsp; @ROWCOUNT &nbsp; &nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">BIGINT</span>; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #808080; font-style: italic;">-- nombre de lignes traitées</span><br />
<br />
<span style="color: #808080; font-style: italic;">--=============================================================================</span><br />
<span style="color: #808080; font-style: italic;">-- TEST TRIVIAUX :</span><br />
<span style="color: #808080; font-style: italic;">--=============================================================================</span><br />
<span style="color: #993333; font-weight: bold;">IF</span> @<span style="color: #993333; font-weight: bold;">LIMIT</span> <span style="color: #993333; font-weight: bold;">IS</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #993333; font-weight: bold;">AND</span> @<span style="color: #993333; font-weight: bold;">LIMIT</span> &nbsp;<span style="color: #cc66cc;">0</span> ou <span style="color: #993333; font-weight: bold;">NULL</span><span style="color: #66cc66;">.</span><span style="color: #ff0000;">', <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;16, 1, @LIMIT);<br />
&nbsp; &nbsp;RETURN;<br />
END;<br />
IF @TABLESAMPLE_PC IS NOT NULL AND <br />
&nbsp; &nbsp;(@TABLESAMPLE_PC &nbsp;100)<br />
BEGIN<br />
&nbsp; &nbsp;DECLARE @TPC VARCHAR(32) = CAST(@TABLESAMPLE_PC AS VARCHAR(32));<br />
&nbsp; &nbsp;RAISERROR('</span>Valeur @TABLESAMPLE_PC <span style="color: #66cc66;">&#40;</span>%s<span style="color: #66cc66;">&#41;</span> incorrecte<span style="color: #66cc66;">.</span> Valeurs possibles <span style="color: #66cc66;">&#93;</span> <span style="color: #cc66cc;">0</span> <span style="color: #66cc66;">..</span> <span style="color: #cc66cc;">100</span> <span style="color: #66cc66;">&#93;</span> ou <span style="color: #993333; font-weight: bold;">NULL</span><span style="color: #66cc66;">.</span><span style="color: #ff0000;">', <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;16, 1, @TPC);<br />
&nbsp; &nbsp;RETURN;<br />
END;<br />
IF @ALEA = 1 AND @ORDER_BY IS NOT NULL<br />
BEGIN<br />
&nbsp; &nbsp;RAISERROR('</span>Valeurs contradictoires : soit <span style="color: #66cc66;">&#40;</span>@ALEA <span style="color: #66cc66;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span> soit <span style="color: #66cc66;">&#40;</span>@ORDER_BY <span style="color: #66cc66;">=</span> %s<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">.</span><span style="color: #ff0000;">', <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;16, 1, @ORDER_BY);<br />
&nbsp; &nbsp;RETURN;<br />
END;<br />
<br />
--=============================================================================<br />
-- TEST FONCTIONNELS :<br />
--=============================================================================<br />
<br />
-- est-ce une vue ?<br />
SELECT @IS_VIEW = CASE WHEN TABLE_TYPE = '</span><span style="color: #993333; font-weight: bold;">VIEW</span><span style="color: #ff0000;">' THEN 1 ELSE 0 END<br />
FROM &nbsp; INFORMATION_SCHEMA.TABLES<br />
WHERE &nbsp;TABLE_SCHEMA = @SCH AND TABLE_NAME = @TBL;<br />
<br />
-- la table ou vue existe-t-elle ?<br />
IF @@ROWCOUNT = 0<br />
BEGIN<br />
&nbsp; &nbsp;RAISERROR('</span>La <span style="color: #993333; font-weight: bold;">TABLE</span> ou vue %s<span style="color: #66cc66;">.</span>%s n<span style="color: #ff0000;">''</span>existe pas dans la base courante<span style="color: #66cc66;">.</span><span style="color: #ff0000;">', <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;16, 1, @SCH, @TBL);<br />
&nbsp; &nbsp;RETURN;<br />
END;<br />
<br />
-- si c'</span>est une vue<span style="color: #66cc66;">,</span> pas de SAMPLE !<br />
<span style="color: #993333; font-weight: bold;">IF</span> @IS_VIEW <span style="color: #66cc66;">=</span> <span style="color: #cc66cc;">1</span> <span style="color: #993333; font-weight: bold;">AND</span> @TABLESAMPLE_PC <span style="color: #993333; font-weight: bold;">IS</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span><br />
<span style="color: #993333; font-weight: bold;">BEGIN</span><br />
&nbsp; &nbsp;RAISERROR<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'L'</span><span style="color: #ff0000;">'objet %s.%s est une vue. @TABLESAMPLE_PC impossible.'</span><span style="color: #66cc66;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #cc66cc;">16</span><span style="color: #66cc66;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #66cc66;">,</span> @SCH<span style="color: #66cc66;">,</span> @TBL<span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp;<span style="color: #993333; font-weight: bold;">RETURN</span>;<br />
<span style="color: #993333; font-weight: bold;">END</span>;<br />
<br />
<span style="color: #993333; font-weight: bold;">SELECT</span> @ORDER_BY <span style="color: #66cc66;">=</span> <span style="color: #993333; font-weight: bold;">NULLIF</span><span style="color: #66cc66;">&#40;</span>@ORDER_BY<span style="color: #66cc66;">,</span> <span style="color: #ff0000;">''</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp;@<span style="color: #993333; font-weight: bold;">WHERE</span> <span style="color: #66cc66;">=</span> <span style="color: #993333; font-weight: bold;">NULLIF</span><span style="color: #66cc66;">&#40;</span>@<span style="color: #993333; font-weight: bold;">WHERE</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">''</span><span style="color: #66cc66;">&#41;</span>;<br />
<br />
<span style="color: #808080; font-style: italic;">-- la clause ORDER BY est-elle valide ?</span><br />
<span style="color: #993333; font-weight: bold;">BEGIN</span> TRY<br />
&nbsp; &nbsp;<span style="color: #993333; font-weight: bold;">SET</span> @<span style="color: #993333; font-weight: bold;">SQL</span> <span style="color: #66cc66;">=</span> N<span style="color: #ff0000;">'SELECT TOP(0) * FROM '</span> <span style="color: #66cc66;">+</span> @O_NAME <span style="color: #66cc66;">+</span> <span style="color: #ff0000;">' ORDER BY '</span> <span style="color: #66cc66;">+</span> @ORDER_BY;<br />
&nbsp; &nbsp;<span style="color: #993333; font-weight: bold;">EXEC</span> <span style="color: #66cc66;">&#40;</span>@<span style="color: #993333; font-weight: bold;">SQL</span><span style="color: #66cc66;">&#41;</span>;<br />
<span style="color: #993333; font-weight: bold;">END</span> TRY &nbsp; <br />
<span style="color: #993333; font-weight: bold;">BEGIN</span> CATCH<br />
&nbsp; &nbsp;RAISERROR<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'Paramètre ORDER BY (%s) invalide pour la table %s.'</span><span style="color: #66cc66;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #cc66cc;">16</span><span style="color: #66cc66;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #66cc66;">,</span> @ORDER_BY<span style="color: #66cc66;">,</span> @O_NAME<span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp;<span style="color: #993333; font-weight: bold;">RETURN</span>;<br />
<span style="color: #993333; font-weight: bold;">END</span> CATCH;<br />
<br />
<span style="color: #808080; font-style: italic;">-- la clause WHERE est-elle valide ?</span><br />
<span style="color: #993333; font-weight: bold;">BEGIN</span> TRY<br />
&nbsp; &nbsp;<span style="color: #993333; font-weight: bold;">SET</span> @<span style="color: #993333; font-weight: bold;">SQL</span> <span style="color: #66cc66;">=</span> N<span style="color: #ff0000;">'SELECT TOP(1) * FROM '</span> <span style="color: #66cc66;">+</span> @O_NAME <span style="color: #66cc66;">+</span> <span style="color: #ff0000;">' WHERE '</span> <span style="color: #66cc66;">+</span> @<span style="color: #993333; font-weight: bold;">WHERE</span>;<br />
&nbsp; &nbsp;<span style="color: #993333; font-weight: bold;">EXEC</span> <span style="color: #66cc66;">&#40;</span>@<span style="color: #993333; font-weight: bold;">SQL</span><span style="color: #66cc66;">&#41;</span>;<br />
<span style="color: #993333; font-weight: bold;">END</span> TRY &nbsp; <br />
<span style="color: #993333; font-weight: bold;">BEGIN</span> CATCH<br />
&nbsp; &nbsp;RAISERROR<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'La clause WHERE (%s) passée en paramètre pour la table %s n'</span><span style="color: #ff0000;">'est pas valide.'</span><span style="color: #66cc66;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #cc66cc;">16</span><span style="color: #66cc66;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #66cc66;">,</span> @<span style="color: #993333; font-weight: bold;">WHERE</span><span style="color: #66cc66;">,</span> @O_NAME<span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp;<span style="color: #993333; font-weight: bold;">RETURN</span>;<br />
<span style="color: #993333; font-weight: bold;">END</span> CATCH;<br />
<br />
<br />
<span style="color: #808080; font-style: italic;">--=============================================================================</span><br />
<span style="color: #808080; font-style: italic;">-- RÉCUPÉRATION DE VALEURS UTILES</span><br />
<span style="color: #808080; font-style: italic;">--=============================================================================</span><br />
<br />
<span style="color: #808080; font-style: italic;">-- récupération de son object_id et formation du nom complet:</span><br />
<span style="color: #993333; font-weight: bold;">SELECT</span> @OID <span style="color: #66cc66;">=</span> OBJECT_ID<span style="color: #66cc66;">&#40;</span>@SCH<span style="color: #66cc66;">+</span><span style="color: #ff0000;">'.'</span><span style="color: #66cc66;">+</span>@TBL<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp;@O_NAME <span style="color: #66cc66;">=</span> N<span style="color: #ff0000;">'['</span> <span style="color: #66cc66;">+</span> @SCH <span style="color: #66cc66;">+</span> <span style="color: #ff0000;">'].['</span> <span style="color: #66cc66;">+</span> @TBL <span style="color: #66cc66;">+</span> <span style="color: #ff0000;">']'</span>;<br />
<br />
<span style="color: #993333; font-weight: bold;">IF</span> @DEBUG <span style="color: #66cc66;">=</span> <span style="color: #cc66cc;">1</span> <span style="color: #993333; font-weight: bold;">SELECT</span> CONCAT<span style="color: #66cc66;">&#40;</span>@O_NAME<span style="color: #66cc66;">,</span> <span style="color: #ff0000;">' : '</span><span style="color: #66cc66;">,</span> @OID<span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">AS</span> NOM_TABLE;<br />
<br />
<span style="color: #808080; font-style: italic;">-- as t-elle une colonne IDENTITY ?</span><br />
<span style="color: #993333; font-weight: bold;">SET</span> @HAS_IDENTITY <span style="color: #66cc66;">=</span> <span style="color: #993333; font-weight: bold;">CAST</span><span style="color: #66cc66;">&#40;</span>OBJECTPROPERTYEX<span style="color: #66cc66;">&#40;</span>@OID<span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'TableHasIdentity'</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">AS</span> BIT<span style="color: #66cc66;">&#41;</span>;<br />
<br />
<span style="color: #808080; font-style: italic;">-- Si pas ,IDENTITY alors, pas de KEEP_ID</span><br />
<span style="color: #993333; font-weight: bold;">IF</span> @HAS_IDENTITY <span style="color: #66cc66;">=</span> <span style="color: #cc66cc;">0</span><br />
&nbsp; &nbsp;<span style="color: #993333; font-weight: bold;">SET</span> @KEEP_ID <span style="color: #66cc66;">=</span> <span style="color: #cc66cc;">0</span>;<br />
<br />
<span style="color: #808080; font-style: italic;">-- quelle est la colonne IDENTITY</span><br />
<span style="color: #993333; font-weight: bold;">IF</span> @HAS_IDENTITY <span style="color: #66cc66;">=</span> <span style="color: #cc66cc;">1</span><br />
&nbsp; &nbsp;<span style="color: #993333; font-weight: bold;">SELECT</span> @COL_IDENTITY <span style="color: #66cc66;">=</span> name <br />
&nbsp; &nbsp;<span style="color: #993333; font-weight: bold;">FROM</span> &nbsp; sys<span style="color: #66cc66;">.</span><span style="color: #993333; font-weight: bold;">COLUMNS</span><br />
&nbsp; &nbsp;<span style="color: #993333; font-weight: bold;">WHERE</span> &nbsp;object_id <span style="color: #66cc66;">=</span> @OID<br />
&nbsp; &nbsp; &nbsp;<span style="color: #993333; font-weight: bold;">AND</span> &nbsp;is_identity <span style="color: #66cc66;">=</span> <span style="color: #cc66cc;">1</span>;<br />
<br />
<span style="color: #993333; font-weight: bold;">IF</span> @DEBUG <span style="color: #66cc66;">=</span> <span style="color: #cc66cc;">1</span> <span style="color: #993333; font-weight: bold;">SELECT</span> CONCAT<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'HAS_IDENTITY ? '</span> <span style="color: #66cc66;">,</span> @HAS_IDENTITY<span style="color: #66cc66;">,</span> <span style="color: #ff0000;">' : '</span><span style="color: #66cc66;">,</span> &nbsp;@COL_IDENTITY<span style="color: #66cc66;">&#41;</span>;<br />
<br />
<span style="color: #808080; font-style: italic;">-- paramétrage de conversion des types en caractères</span><br />
<span style="color: #993333; font-weight: bold;">DECLARE</span> @TYPES <span style="color: #993333; font-weight: bold;">TABLE</span> <br />
&nbsp; &nbsp;<span style="color: #66cc66;">&#40;</span>sys_type_name sysname<span style="color: #66cc66;">,</span> type_familly <span style="color: #993333; font-weight: bold;">VARCHAR</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">16</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span> transform <span style="color: #993333; font-weight: bold;">VARCHAR</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">64</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;<br />
<span style="color: #993333; font-weight: bold;">INSERT</span> <span style="color: #993333; font-weight: bold;">INTO</span> @TYPES<br />
<span style="color: #993333; font-weight: bold;">SELECT</span> name<span style="color: #66cc66;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #993333; font-weight: bold;">CASE</span> <span style="color: #993333; font-weight: bold;">WHEN</span> name <span style="color: #993333; font-weight: bold;">LIKE</span> <span style="color: #ff0000;">'%char'</span> <span style="color: #993333; font-weight: bold;">OR</span> name <span style="color: #66cc66;">=</span> <span style="color: #ff0000;">'sysname'</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #993333; font-weight: bold;">THEN</span> <span style="color: #ff0000;">'CHAR'</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">WHEN</span> name <span style="color: #993333; font-weight: bold;">IN</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'float'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'real'</span><span style="color: #66cc66;">&#41;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #993333; font-weight: bold;">THEN</span> <span style="color: #ff0000;">'REAL'</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">WHEN</span> name <span style="color: #993333; font-weight: bold;">IN</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'decimal'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'numeric'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'money'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'smallmoney'</span><span style="color: #66cc66;">&#41;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #993333; font-weight: bold;">THEN</span> <span style="color: #ff0000;">'DEC'</span> &nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">WHEN</span> name <span style="color: #993333; font-weight: bold;">IN</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'tinyint'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'smallint'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'int'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'bigint'</span><span style="color: #66cc66;">&#41;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #993333; font-weight: bold;">THEN</span> <span style="color: #ff0000;">'INT'</span> &nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">WHEN</span> name <span style="color: #993333; font-weight: bold;">IN</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'binary'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'varbinary'</span><span style="color: #66cc66;">&#41;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #993333; font-weight: bold;">THEN</span> <span style="color: #ff0000;">'BIN'</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">WHEN</span> name <span style="color: #993333; font-weight: bold;">IN</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'date'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'time'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'datetime'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'datetime2'</span><span style="color: #66cc66;">&#41;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #993333; font-weight: bold;">THEN</span> <span style="color: #ff0000;">'DATIME'</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">WHEN</span> name <span style="color: #66cc66;">=</span> <span style="color: #ff0000;">'uniqueidentifier'</span> <span style="color: #993333; font-weight: bold;">THEN</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #ff0000;">'GUID'</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">WHEN</span> name <span style="color: #66cc66;">=</span> <span style="color: #ff0000;">'bit'</span> <span style="color: #993333; font-weight: bold;">THEN</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #ff0000;">'BIT'</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">WHEN</span> name <span style="color: #66cc66;">=</span> <span style="color: #ff0000;">'datetimeoffset'</span> <span style="color: #993333; font-weight: bold;">THEN</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #ff0000;">'DTZ'</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">ELSE</span> <span style="color: #ff0000;">'LOB'</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #993333; font-weight: bold;">END</span><span style="color: #66cc66;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #993333; font-weight: bold;">CASE</span> <span style="color: #993333; font-weight: bold;">WHEN</span> name <span style="color: #993333; font-weight: bold;">LIKE</span> <span style="color: #ff0000;">'%varchar'</span> <span style="color: #993333; font-weight: bold;">OR</span> name <span style="color: #66cc66;">=</span> <span style="color: #ff0000;">'sysname'</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #993333; font-weight: bold;">THEN</span> <span style="color: #ff0000;">''</span><span style="color: #ff0000;">''</span><span style="color: #ff0000;">''</span><span style="color: #ff0000;">''</span><span style="color: #ff0000;">' + REPLACE(#VAL, '</span><span style="color: #ff0000;">''</span><span style="color: #ff0000;">''</span><span style="color: #ff0000;">''</span><span style="color: #ff0000;">', '</span><span style="color: #ff0000;">''</span><span style="color: #ff0000;">''</span><span style="color: #ff0000;">''</span><span style="color: #ff0000;">''</span><span style="color: #ff0000;">''</span><span style="color: #ff0000;">') + '</span><span style="color: #ff0000;">''</span><span style="color: #ff0000;">''</span><span style="color: #ff0000;">''</span><span style="color: #ff0000;">''</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">WHEN</span> name <span style="color: #993333; font-weight: bold;">LIKE</span> <span style="color: #ff0000;">'%char'</span> <span style="color: #993333; font-weight: bold;">OR</span> name <span style="color: #66cc66;">=</span> <span style="color: #ff0000;">'sysname'</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #993333; font-weight: bold;">THEN</span> <span style="color: #ff0000;">''</span><span style="color: #ff0000;">''</span><span style="color: #ff0000;">''</span><span style="color: #ff0000;">''</span><span style="color: #ff0000;">' + REPLACE(RTRIM(#VAL), '</span><span style="color: #ff0000;">''</span><span style="color: #ff0000;">''</span><span style="color: #ff0000;">''</span><span style="color: #ff0000;">', '</span><span style="color: #ff0000;">''</span><span style="color: #ff0000;">''</span><span style="color: #ff0000;">''</span><span style="color: #ff0000;">''</span><span style="color: #ff0000;">''</span><span style="color: #ff0000;">') + '</span><span style="color: #ff0000;">''</span><span style="color: #ff0000;">''</span><span style="color: #ff0000;">''</span><span style="color: #ff0000;">''</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">WHEN</span> name <span style="color: #993333; font-weight: bold;">IN</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'float'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'real'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'decimal'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'numeric'</span><span style="color: #66cc66;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'money'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'smallmoney'</span><span style="color: #66cc66;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'tinyint'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'smallint'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'int'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'bigint'</span><span style="color: #66cc66;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'uniqueidentifier'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'bit'</span><span style="color: #66cc66;">&#41;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #993333; font-weight: bold;">THEN</span> <span style="color: #ff0000;">'CAST(#VAL AS VARCHAR(38))'</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">WHEN</span> name <span style="color: #993333; font-weight: bold;">IN</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'date'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'time'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'datetime'</span><span style="color: #66cc66;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'datetime2'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'datetimeoffset'</span><span style="color: #66cc66;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #993333; font-weight: bold;">THEN</span> <span style="color: #ff0000;">''</span><span style="color: #ff0000;">''</span><span style="color: #ff0000;">''</span><span style="color: #ff0000;">''</span><span style="color: #ff0000;">' + CONVERT(VARCHAR(36), #VAL, 127) + '</span><span style="color: #ff0000;">''</span><span style="color: #ff0000;">''</span><span style="color: #ff0000;">''</span><span style="color: #ff0000;">''</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">ELSE</span> <span style="color: #ff0000;">'CONVERT(varchar(max),#VAL,2)'</span><br />
&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #993333; font-weight: bold;">END</span><br />
<span style="color: #993333; font-weight: bold;">FROM</span> sys<span style="color: #66cc66;">.</span>systypes;<br />
<br />
<span style="color: #993333; font-weight: bold;">IF</span> @DEBUG <span style="color: #66cc66;">=</span> <span style="color: #cc66cc;">1</span> <span style="color: #993333; font-weight: bold;">SELECT</span> <span style="color: #66cc66;">*</span> <span style="color: #993333; font-weight: bold;">FROM</span> @TYPES;<br />
<br />
<span style="color: #808080; font-style: italic;">-- tables des colonnes et transformetion a effectuée pour la table a exporter</span><br />
<span style="color: #993333; font-weight: bold;">DECLARE</span> @<span style="color: #993333; font-weight: bold;">COLUMNS</span> <span style="color: #993333; font-weight: bold;">TABLE</span> <br />
<span style="color: #66cc66;">&#40;</span>column_ordinal &nbsp;<span style="color: #993333; font-weight: bold;">INT</span><span style="color: #66cc66;">,</span> <br />
&nbsp;column_name &nbsp; &nbsp; &nbsp;sysname<span style="color: #66cc66;">,</span> <br />
&nbsp;sys_type_name &nbsp; sysname<span style="color: #66cc66;">,</span> <br />
&nbsp;type_familly &nbsp; &nbsp;sysname<span style="color: #66cc66;">,</span><br />
&nbsp;col_transform &nbsp; <span style="color: #993333; font-weight: bold;">VARCHAR</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">200</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;<br />
<br />
<span style="color: #808080; font-style: italic;">-- alimentation de la table des colonnes avec le paramétrage de conversion</span><br />
<span style="color: #993333; font-weight: bold;">INSERT</span> <span style="color: #993333; font-weight: bold;">INTO</span> @<span style="color: #993333; font-weight: bold;">COLUMNS</span> <span style="color: #66cc66;">&#40;</span>column_ordinal<span style="color: #66cc66;">,</span> column_name<span style="color: #66cc66;">,</span> sys_type_name<span style="color: #66cc66;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; type_familly<span style="color: #66cc66;">,</span> col_transform<span style="color: #66cc66;">&#41;</span><br />
<span style="color: #993333; font-weight: bold;">SELECT</span> <span style="color: #993333; font-weight: bold;">ROW_NUMBER</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">OVER</span><span style="color: #66cc66;">&#40;</span><span style="color: #993333; font-weight: bold;">ORDER</span> <span style="color: #993333; font-weight: bold;">BY</span> column_id<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp;c<span style="color: #66cc66;">.</span>name<span style="color: #66cc66;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #993333; font-weight: bold;">CASE</span> c<span style="color: #66cc66;">.</span>max_length <span style="color: #993333; font-weight: bold;">WHEN</span> <span style="color: #66cc66;">-</span><span style="color: #cc66cc;">1</span> <span style="color: #993333; font-weight: bold;">THEN</span> <span style="color: #ff0000;">'ntext'</span> <span style="color: #993333; font-weight: bold;">ELSE</span> t<span style="color: #66cc66;">.</span>name <span style="color: #993333; font-weight: bold;">END</span><span style="color: #66cc66;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp;type_familly<span style="color: #66cc66;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp;transform<br />
<span style="color: #993333; font-weight: bold;">FROM</span> &nbsp; sys<span style="color: #66cc66;">.</span><span style="color: #993333; font-weight: bold;">COLUMNS</span> <span style="color: #993333; font-weight: bold;">AS</span> c<br />
&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #993333; font-weight: bold;">JOIN</span> sys<span style="color: #66cc66;">.</span>types <span style="color: #993333; font-weight: bold;">AS</span> tu <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">ON</span> c<span style="color: #66cc66;">.</span>user_type_id <span style="color: #66cc66;">=</span> tu<span style="color: #66cc66;">.</span>user_type_id<br />
&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #993333; font-weight: bold;">JOIN</span> sys<span style="color: #66cc66;">.</span>types <span style="color: #993333; font-weight: bold;">AS</span> t <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">ON</span> tu<span style="color: #66cc66;">.</span>system_type_id <span style="color: #66cc66;">=</span> t<span style="color: #66cc66;">.</span>user_type_id<br />
&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #993333; font-weight: bold;">JOIN</span> @TYPES <span style="color: #993333; font-weight: bold;">AS</span> tp <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">ON</span> <span style="color: #993333; font-weight: bold;">CASE</span> c<span style="color: #66cc66;">.</span>max_length <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">WHEN</span> <span style="color: #66cc66;">-</span><span style="color: #cc66cc;">1</span> <span style="color: #993333; font-weight: bold;">THEN</span> <span style="color: #ff0000;">'ntext'</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">ELSE</span> t<span style="color: #66cc66;">.</span>name <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #993333; font-weight: bold;">END</span> <span style="color: #66cc66;">=</span>tp<span style="color: #66cc66;">.</span>sys_type_name<br />
<span style="color: #993333; font-weight: bold;">WHERE</span> &nbsp;c<span style="color: #66cc66;">.</span>object_id <span style="color: #66cc66;">=</span> @OID<br />
<span style="color: #993333; font-weight: bold;">AND</span> &nbsp; &nbsp;type_familly <span style="color: #993333; font-weight: bold;">IN</span> <span style="color: #66cc66;">&#40;</span><span style="color: #993333; font-weight: bold;">SELECT</span> type_familly<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">FROM</span> &nbsp; @TYPES<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">EXCEPT</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">SELECT</span> <span style="color: #ff0000;">'LOB'</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">WHERE</span> &nbsp;@KEEP_LOBS <span style="color: #66cc66;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span><br />
<span style="color: #993333; font-weight: bold;">AND</span> &nbsp; &nbsp;c<span style="color: #66cc66;">.</span>name &nbsp;!<span style="color: #66cc66;">=</span> <span style="color: #993333; font-weight: bold;">CASE</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #993333; font-weight: bold;">WHEN</span> @KEEP_ID <span style="color: #66cc66;">=</span> <span style="color: #cc66cc;">0</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">THEN</span> <span style="color: #993333; font-weight: bold;">COALESCE</span><span style="color: #66cc66;">&#40;</span>@COL_IDENTITY<span style="color: #66cc66;">,</span> <span style="color: #ff0000;">''</span><span style="color: #66cc66;">&#41;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #993333; font-weight: bold;">ELSE</span> <span style="color: #ff0000;">''</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">END</span>;<br />
<br />
<span style="color: #993333; font-weight: bold;">IF</span> @DEBUG <span style="color: #66cc66;">=</span> <span style="color: #cc66cc;">1</span> <span style="color: #993333; font-weight: bold;">SELECT</span> <span style="color: #66cc66;">*</span> <span style="color: #993333; font-weight: bold;">FROM</span> @<span style="color: #993333; font-weight: bold;">COLUMNS</span>;<br />
<br />
<span style="color: #808080; font-style: italic;">-- obtention de la liste des colonnes </span><br />
<span style="color: #993333; font-weight: bold;">SELECT</span> @COLS <span style="color: #66cc66;">=</span> LTRIM<span style="color: #66cc66;">&#40;</span>STUFF<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span><span style="color: #993333; font-weight: bold;">SELECT</span> <span style="color: #ff0000;">', '</span> <span style="color: #66cc66;">+</span> <span style="color: #ff0000;">'['</span> <span style="color: #66cc66;">+</span> column_name <span style="color: #66cc66;">+</span> <span style="color: #ff0000;">']'</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">FROM</span> &nbsp; @<span style="color: #993333; font-weight: bold;">COLUMNS</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">FOR</span> XML PATH<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">''</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span><span style="color: #cc66cc;">1</span><span style="color: #66cc66;">,</span><span style="color: #cc66cc;">1</span><span style="color: #66cc66;">,</span><span style="color: #ff0000;">''</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;<br />
<br />
<span style="color: #993333; font-weight: bold;">IF</span> @DEBUG <span style="color: #66cc66;">=</span> <span style="color: #cc66cc;">1</span> <span style="color: #993333; font-weight: bold;">SELECT</span> @COLS <span style="color: #993333; font-weight: bold;">AS</span> COLONNES<br />
<br />
<span style="color: #808080; font-style: italic;">--=============================================================================</span><br />
<span style="color: #808080; font-style: italic;">-- RÉCUPÉRATION DES LIGNES</span><br />
<span style="color: #808080; font-style: italic;">--=============================================================================</span><br />
<br />
<span style="color: #808080; font-style: italic;">-- construction dynamique de la requête capturant les données</span><br />
<span style="color: #993333; font-weight: bold;">SET</span> @<span style="color: #993333; font-weight: bold;">SQL</span> <span style="color: #66cc66;">=</span> N<span style="color: #ff0000;">'SELECT '</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #66cc66;">+</span> <span style="color: #993333; font-weight: bold;">CASE</span> <span style="color: #993333; font-weight: bold;">WHEN</span> <span style="color: #66cc66;">&#40;</span>@ORDER_BY <span style="color: #993333; font-weight: bold;">IS</span> <span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #993333; font-weight: bold;">OR</span> @ORDER_BY <span style="color: #66cc66;">=</span> <span style="color: #ff0000;">''</span><span style="color: #66cc66;">&#41;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">AND</span> @<span style="color: #993333; font-weight: bold;">LIMIT</span> <span style="color: #993333; font-weight: bold;">IS</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">THEN</span> N<span style="color: #ff0000;">'TOP('</span> <span style="color: #66cc66;">+</span> <span style="color: #993333; font-weight: bold;">CAST</span><span style="color: #66cc66;">&#40;</span>@<span style="color: #993333; font-weight: bold;">LIMIT</span> <span style="color: #993333; font-weight: bold;">AS</span> NVARCHAR<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">32</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">+</span> N<span style="color: #ff0000;">') '</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">ELSE</span> N<span style="color: #ff0000;">''</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #993333; font-weight: bold;">END</span> <span style="color: #66cc66;">+</span> N<span style="color: #ff0000;">'IDENTITY(BIGINT, 1, 1) AS ___, '</span> <span style="color: #66cc66;">+</span> @COLS<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #66cc66;">+</span> N<span style="color: #ff0000;">'INTO ##EXPORT_INSERT_53514C70726F '</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #66cc66;">+</span> N<span style="color: #ff0000;">'FROM '</span> <span style="color: #66cc66;">+</span> @O_NAME <span style="color: #66cc66;">+</span> N<span style="color: #ff0000;">' '</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #66cc66;">+</span> <span style="color: #993333; font-weight: bold;">COALESCE</span><span style="color: #66cc66;">&#40;</span>N<span style="color: #ff0000;">'TABLESAMPLE ('</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">+</span> <span style="color: #993333; font-weight: bold;">CAST</span><span style="color: #66cc66;">&#40;</span>@TABLESAMPLE_PC <span style="color: #993333; font-weight: bold;">AS</span> NVARCHAR<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">32</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">+</span> N<span style="color: #ff0000;">' PERCENT) '</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">''</span><span style="color: #66cc66;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #66cc66;">+</span> <span style="color: #993333; font-weight: bold;">COALESCE</span><span style="color: #66cc66;">&#40;</span>N<span style="color: #ff0000;">'WHERE '</span> <span style="color: #66cc66;">+</span> @<span style="color: #993333; font-weight: bold;">WHERE</span> <span style="color: #66cc66;">+</span> <span style="color: #ff0000;">' '</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">''</span><span style="color: #66cc66;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #66cc66;">+</span> <span style="color: #993333; font-weight: bold;">CASE</span> <span style="color: #993333; font-weight: bold;">WHEN</span> @ALEA <span style="color: #66cc66;">=</span> <span style="color: #cc66cc;">1</span> <span style="color: #993333; font-weight: bold;">THEN</span> N<span style="color: #ff0000;">'ORDER BY NEWID() '</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">WHEN</span> @ORDER_BY <span style="color: #993333; font-weight: bold;">IS</span> <span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #993333; font-weight: bold;">THEN</span> <span style="color: #ff0000;">''</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">WHEN</span> @<span style="color: #993333; font-weight: bold;">LIMIT</span> <span style="color: #993333; font-weight: bold;">IS</span> <span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #993333; font-weight: bold;">THEN</span> N<span style="color: #ff0000;">'ORDER BY '</span> <span style="color: #66cc66;">+</span> @ORDER_BY<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">ELSE</span> N<span style="color: #ff0000;">'ORDER BY '</span> <span style="color: #66cc66;">+</span> @ORDER_BY <span style="color: #66cc66;">+</span> N<span style="color: #ff0000;">'OFFSET 0 ROW FETCH NEXT '</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #66cc66;">+</span> <span style="color: #993333; font-weight: bold;">CAST</span><span style="color: #66cc66;">&#40;</span>@<span style="color: #993333; font-weight: bold;">LIMIT</span> <span style="color: #993333; font-weight: bold;">AS</span> NVARCHAR<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">32</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">+</span> N<span style="color: #ff0000;">' ROWS ONLY'</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #993333; font-weight: bold;">END</span>;<br />
<br />
<br />
<span style="color: #993333; font-weight: bold;">IF</span> @DEBUG <span style="color: #66cc66;">=</span> <span style="color: #cc66cc;">1</span> <span style="color: #993333; font-weight: bold;">SELECT</span> @<span style="color: #993333; font-weight: bold;">SQL</span> <span style="color: #993333; font-weight: bold;">AS</span> <span style="color: #ff0000;">&quot;SQL&quot;</span>; <br />
<br />
<span style="color: #808080; font-style: italic;">-- renvoie du texte de la requête dans l'onglet message</span><br />
PRINT <span style="color: #993333; font-weight: bold;">REPLACE</span><span style="color: #66cc66;">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #993333; font-weight: bold;">REPLACE</span><span style="color: #66cc66;">&#40;</span>@<span style="color: #993333; font-weight: bold;">SQL</span><span style="color: #66cc66;">,</span> N<span style="color: #ff0000;">'INTO ##EXPORT_INSERT_53514C70726F '</span><span style="color: #66cc66;">,</span> N<span style="color: #ff0000;">''</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #ff0000;">'IDENTITY(BIGINT, 1, 1) AS ___, '</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">''</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">+</span> <span style="color: #ff0000;">';'</span>;<br />
<br />
<span style="color: #808080; font-style: italic;">-- exécution de la requête dynamique de capture des données</span><br />
<span style="color: #993333; font-weight: bold;">IF</span> @NOLOCK <span style="color: #66cc66;">=</span> <span style="color: #cc66cc;">1</span><br />
&nbsp; &nbsp;<span style="color: #993333; font-weight: bold;">SET</span> <span style="color: #993333; font-weight: bold;">TRANSACTION</span> ISOLATION LEVEL <span style="color: #993333; font-weight: bold;">READ</span> UNCOMMITTED;<br />
<span style="color: #993333; font-weight: bold;">ELSE</span> &nbsp; &nbsp;<br />
&nbsp; &nbsp;<span style="color: #993333; font-weight: bold;">SET</span> <span style="color: #993333; font-weight: bold;">TRANSACTION</span> ISOLATION LEVEL <span style="color: #993333; font-weight: bold;">READ</span> COMMITTED;<br />
<span style="color: #993333; font-weight: bold;">BEGIN</span> TRY<br />
&nbsp; &nbsp;<span style="color: #993333; font-weight: bold;">EXEC</span> <span style="color: #66cc66;">&#40;</span>@<span style="color: #993333; font-weight: bold;">SQL</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp;<span style="color: #993333; font-weight: bold;">SET</span> @ROWCOUNT <span style="color: #66cc66;">=</span> @@ROWCOUNT;<br />
<span style="color: #993333; font-weight: bold;">END</span> TRY<br />
<span style="color: #993333; font-weight: bold;">BEGIN</span> CATCH<br />
&nbsp; &nbsp;<span style="color: #993333; font-weight: bold;">DROP</span> <span style="color: #993333; font-weight: bold;">TABLE</span> ##EXPORT_INSERT_53514C70726F;<br />
&nbsp; &nbsp;THROW;<br />
&nbsp; &nbsp;<span style="color: #993333; font-weight: bold;">RETURN</span>;<br />
<span style="color: #993333; font-weight: bold;">END</span> CATCH;<br />
<span style="color: #808080; font-style: italic;">-- renvoie le nombre de ligne à exporter dans l'onglet message</span><br />
PRINT <span style="color: #993333; font-weight: bold;">CAST</span><span style="color: #66cc66;">&#40;</span>@ROWCOUNT <span style="color: #993333; font-weight: bold;">AS</span> <span style="color: #993333; font-weight: bold;">VARCHAR</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">32</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">+</span> <span style="color: #ff0000;">' rows returned'</span>;<br />
<br />
<span style="color: #808080; font-style: italic;">-- construction de la requête générant le résultat</span><br />
<span style="color: #993333; font-weight: bold;">IF</span> @KEEP_ID <span style="color: #66cc66;">=</span> <span style="color: #cc66cc;">1</span><br />
&nbsp; &nbsp;<span style="color: #993333; font-weight: bold;">SELECT</span> N<span style="color: #ff0000;">'SET IDENTITY_INSERT '</span> <span style="color: #66cc66;">+</span> @O_NAME <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">+</span> <span style="color: #ff0000;">' ON;'</span>; &nbsp;<br />
<span style="color: #993333; font-weight: bold;">SET</span> @<span style="color: #993333; font-weight: bold;">SQL</span> <span style="color: #66cc66;">=</span> N<span style="color: #ff0000;">''</span>;<br />
<span style="color: #993333; font-weight: bold;">SET</span> @<span style="color: #993333; font-weight: bold;">SQL</span> <span style="color: #66cc66;">=</span> @<span style="color: #993333; font-weight: bold;">SQL</span> <span style="color: #66cc66;">+</span> &nbsp;N<span style="color: #ff0000;">'SELECT '</span><span style="color: #ff0000;">'INSERT INTO '</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #66cc66;">+</span> @O_NAME <span style="color: #66cc66;">+</span> N<span style="color: #ff0000;">' ('</span> <span style="color: #66cc66;">+</span> @COLS <span style="color: #66cc66;">+</span> N<span style="color: #ff0000;">') VALUES ('</span><span style="color: #ff0000;">' + '</span><br />
<span style="color: #993333; font-weight: bold;">SELECT</span> @<span style="color: #993333; font-weight: bold;">SQL</span> <span style="color: #66cc66;">=</span> @<span style="color: #993333; font-weight: bold;">SQL</span> <span style="color: #66cc66;">+</span> <span style="color: #ff0000;">'COALESCE('</span> <span style="color: #66cc66;">+</span><br />
&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #66cc66;">+</span> <span style="color: #993333; font-weight: bold;">REPLACE</span><span style="color: #66cc66;">&#40;</span>col_transform<span style="color: #66cc66;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;N<span style="color: #ff0000;">'#VAL'</span><span style="color: #66cc66;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;N<span style="color: #ff0000;">'['</span> <span style="color: #66cc66;">+</span> column_name <span style="color: #66cc66;">+</span> N<span style="color: #ff0000;">']'</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">+</span> <span style="color: #ff0000;">', '</span><span style="color: #ff0000;">'NULL'</span><span style="color: #ff0000;">') + '</span><span style="color: #ff0000;">', '</span><span style="color: #ff0000;">' + '</span><br />
<span style="color: #993333; font-weight: bold;">FROM</span> &nbsp; @<span style="color: #993333; font-weight: bold;">COLUMNS</span><br />
<span style="color: #993333; font-weight: bold;">ORDER</span> &nbsp;<span style="color: #993333; font-weight: bold;">BY</span> column_ordinal;<br />
<span style="color: #993333; font-weight: bold;">SET</span> @<span style="color: #993333; font-weight: bold;">SQL</span> <span style="color: #66cc66;">=</span> <span style="color: #993333; font-weight: bold;">LEFT</span><span style="color: #66cc66;">&#40;</span>@<span style="color: #993333; font-weight: bold;">SQL</span><span style="color: #66cc66;">,</span> LEN<span style="color: #66cc66;">&#40;</span>@<span style="color: #993333; font-weight: bold;">SQL</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">-</span> <span style="color: #cc66cc;">8</span><span style="color: #66cc66;">&#41;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #66cc66;">+</span> N<span style="color: #ff0000;">' + '</span><span style="color: #ff0000;">');'</span><span style="color: #ff0000;">' &nbsp;FROM ##EXPORT_INSERT_53514C70726F ORDER BY ___'</span><br />
<br />
<span style="color: #993333; font-weight: bold;">IF</span> @DEBUG <span style="color: #66cc66;">=</span> <span style="color: #cc66cc;">1</span> <span style="color: #993333; font-weight: bold;">SELECT</span> @<span style="color: #993333; font-weight: bold;">SQL</span> <span style="color: #993333; font-weight: bold;">AS</span> <span style="color: #ff0000;">&quot;SQL&quot;</span>;<br />
<br />
<span style="color: #808080; font-style: italic;">-- exécution de la requête générant les INSERTs</span><br />
<span style="color: #993333; font-weight: bold;">EXEC</span> <span style="color: #66cc66;">&#40;</span>@<span style="color: #993333; font-weight: bold;">SQL</span><span style="color: #66cc66;">&#41;</span><br />
<br />
<span style="color: #993333; font-weight: bold;">IF</span> @KEEP_ID <span style="color: #66cc66;">=</span> <span style="color: #cc66cc;">1</span><br />
&nbsp; &nbsp;<span style="color: #993333; font-weight: bold;">SELECT</span> <span style="color: #ff0000;">'SET IDENTITY_INSERT '</span> <span style="color: #66cc66;">+</span> @O_NAME <span style="color: #66cc66;">+</span> <span style="color: #ff0000;">' OFF'</span>;<br />
&nbsp; &nbsp;<br />
<span style="color: #808080; font-style: italic;">-- suppression de la table temporaire</span><br />
<span style="color: #993333; font-weight: bold;">DROP</span> <span style="color: #993333; font-weight: bold;">TABLE</span> ##EXPORT_INSERT_53514C70726F;<br />
<br />
<span style="color: #993333; font-weight: bold;">END</span>;<br />
<span style="color: #993333; font-weight: bold;">GO</span></div></div>
<p>Cette procédure doit être marquée à titre de procédure système afin de pouvoir être utilisée depuis n&rsquo;importe quelle base. Il faut, bien entendu l&rsquo;avoir préalablement créée dans la base master. Ceci s&rsquo;effectue à l&rsquo;aide de la commande :</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">EXEC sys.sp_MS_marksystemobject 'dbo.sp__GENERATE_INSERT';</div></div>
<p><strong>EXEMPLES :</strong></p>
<p>Voici quelques exemples d&rsquo;exécution :</p>
<div class="codecolorer-container sql default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="sql codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #993333; font-weight: bold;">USE</span> mabase<br />
<span style="color: #993333; font-weight: bold;">GO</span><br />
<br />
<span style="color: #993333; font-weight: bold;">EXEC</span> dbo<span style="color: #66cc66;">.</span>sp__GENERATE_INSERT <br />
&nbsp; &nbsp;@SCH &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #66cc66;">=</span> <span style="color: #ff0000;">'dbo'</span><span style="color: #66cc66;">,</span> &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">-- schema de la table visée</span><br />
&nbsp; &nbsp;@TBL &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #66cc66;">=</span> <span style="color: #ff0000;">'customers'</span><span style="color: #66cc66;">,</span> <span style="color: #808080; font-style: italic;">-- nom de la table visée</span><br />
&nbsp; &nbsp;@<span style="color: #993333; font-weight: bold;">LIMIT</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #66cc66;">=</span> <span style="color: #cc66cc;">100</span><span style="color: #66cc66;">,</span> &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">-- limite en nombre de lignes</span><br />
&nbsp; &nbsp;@KEEP_ID &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #66cc66;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">,</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">-- conservation des auto incréments</span><br />
&nbsp; &nbsp;@ALEA &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #66cc66;">,</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">-- valeur dans un ordre aléatoire </span><br />
&nbsp; &nbsp;@TABLESAMPLE_PC &nbsp; <span style="color: #66cc66;">=</span> <span style="color: #993333; font-weight: bold;">NULL</span><span style="color: #66cc66;">,</span> &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #808080; font-style: italic;">-- échantillon en pourcentage</span><br />
&nbsp; &nbsp;@ORDER_BY &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">=</span> <span style="color: #993333; font-weight: bold;">NULL</span><span style="color: #66cc66;">,</span> &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #808080; font-style: italic;">-- clause ORDER BY de la requête</span><br />
&nbsp; &nbsp;@<span style="color: #993333; font-weight: bold;">WHERE</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #66cc66;">=</span> <span style="color: #993333; font-weight: bold;">NULL</span><span style="color: #66cc66;">,</span> &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #808080; font-style: italic;">-- clause WHERE de la requête</span><br />
&nbsp; &nbsp;@NOLOCK &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #66cc66;">,</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">-- lecture sale</span><br />
&nbsp; &nbsp;@KEEP_LOBS &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #66cc66;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">,</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">-- ne pas prendre en compte les &quot;LOBs&quot;</span><br />
&nbsp; &nbsp;@DEBUG &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #66cc66;">=</span> <span style="color: #cc66cc;">1</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #808080; font-style: italic;">-- mode débogage activé</span><br />
<span style="color: #993333; font-weight: bold;">GO</span><br />
<br />
<span style="color: #993333; font-weight: bold;">EXEC</span> dbo<span style="color: #66cc66;">.</span>sp__GENERATE_INSERT &nbsp;@TBL<span style="color: #66cc66;">=</span> <span style="color: #ff0000;">'customers'</span>;<br />
<span style="color: #993333; font-weight: bold;">GO</span></div></div>
<p><strong>LE CODE * LE CODE * LE CODE * LE CODE * LE CODE * LE CODE * LE CODE * LE CODE * LE CODE</strong><br />
<a href="http://sqlpro.developpez.com/_fichierSQL/GenerateInsert.txt" title="Fichier du code" target="_blank">Le code !</a></p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">Frédéric Brouard, alias SQLpro, ARCHITECTE DE DONNÉES<br />
Expert &nbsp;S.G.B.D &nbsp;relationnelles &nbsp; et &nbsp; langage &nbsp;S.Q.L<br />
Moste &nbsp;Valuable &nbsp;Professionnal &nbsp;Microsoft &nbsp;SQL Server<br />
Société SQLspot &nbsp;: &nbsp;modélisation, conseil, formation,<br />
optimisation, &nbsp;audit, &nbsp;tuning, &nbsp;administration &nbsp;SGBDR<br />
Enseignant: CNAM PACA, ISEN Toulon, CESI Aix en Prov.</div></div>
<p>L&rsquo;entreprise <a href="http://www.sqlspot.com">SQL Spot</a><br />
<strong>Le site web sur le </strong><a href="http://sqlpro.developpez.com/">SQL et les SGBDR</a></p>
<p><img src="http://blog.developpez.com/media/Microsoft_MVP_logo_vertical Brouard 400.jpg" width="400" height="135" alt="MVP Microsoft SQL
Server" /></p>
<div id="attachment_590" style="width: 548px" class="wp-caption alignnone"><a href="http://blog.developpez.com/sqlpro/files/2015/09/Couverture-livre-SQL-server-Eyrolles.jpg"><img src="http://blog.developpez.com/sqlpro/files/2015/09/Couverture-livre-SQL-server-Eyrolles.jpg" alt="Développez et administrez pour la performance avec SQL Server 2014" width="538" height="652" class="size-full wp-image-590" /></a><p class="wp-caption-text">Développez et administrez pour la performance avec SQL Server 2014</p></div>
]]></content:encoded>
			<wfw:commentRss></wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
