<?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>Scriptmatico.Com &#187; SQL SERVER</title>
	<atom:link href="http://www.scriptmatico.com/category/sql-server/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.scriptmatico.com</link>
	<description>Blog de tecnologia, programacion, articulos y mas...</description>
	<lastBuildDate>Thu, 01 Apr 2010 00:43:08 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Recorrer Una tabla Con T-SQL usando cursores</title>
		<link>http://www.scriptmatico.com/2007/08/13/recorrer-una-tabla-con-t-sql-usando-cursores/</link>
		<comments>http://www.scriptmatico.com/2007/08/13/recorrer-una-tabla-con-t-sql-usando-cursores/#comments</comments>
		<pubDate>Tue, 14 Aug 2007 03:17:34 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[SQL SERVER]]></category>

		<guid isPermaLink="false">http://www.exodo999.phpnet.us/?p=37</guid>
		<description><![CDATA[Supongamos que necesitamos recorrer todos los registros de una tabla con T-SQL el lenguaje usado en los Procedimientos Almacenados de SQL Server, bien el codigo es muy sencillo y facil de entender.
Aqui les pongo el codigo:
PLAIN TEXT
SQL:




//declaramos el Cursor para la consulta


DECLARE TODOS CURSOR FOR


SELECT PK_CVEPROFESOR FROM DBO.T012_CPROFESOR ORDER BY PK_CVEPROFESOR


/*Abrimos el cursor*/


OPEN TODOS


/*Extraemos el [...]]]></description>
			<content:encoded><![CDATA[<p>Supongamos que necesitamos recorrer todos los registros de una tabla con T-SQL el lenguaje usado en los Procedimientos Almacenados de SQL Server, bien el codigo es muy sencillo y facil de entender.</p>
<p>Aqui les pongo el codigo:</p>
<div class="igBar"><span id="lsql-2"><a href="#" onclick="javascript:showPlainTxt('sql-2'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">SQL:</span>
<div id="sql-2">
<div class="sql">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">//declaramos el Cursor para la consulta</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">DECLARE TODOS CURSOR <span style="color: #993333; font-weight: bold;">FOR</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333; font-weight: bold;">SELECT</span> PK_CVEPROFESOR <span style="color: #993333; font-weight: bold;">FROM</span> DBO.T012_CPROFESOR <span style="color: #993333; font-weight: bold;">ORDER</span> <span style="color: #993333; font-weight: bold;">BY</span> PK_CVEPROFESOR</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">/*Abrimos el cursor*/</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">OPEN TODOS</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">/*Extraemos el Primer registo*/</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">FETCH NEXT <span style="color: #993333; font-weight: bold;">FROM</span> TODOS</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333; font-weight: bold;">INTO</span> @PROFESOR</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">/* imprimimos todos los registros mientras la variable @@FETCH_STATUS sea igual a 0*/</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">WHILE @@FETCH_STATUS = <span style="color: #cc66cc;color:#800000;">0</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">BEGIN</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">PRINT @PROFESOR</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">/*Nos Movemos al siguiente registro*/</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">FETCH NEXT <span style="color: #993333; font-weight: bold;">FROM</span> TODOS <span style="color: #993333; font-weight: bold;">INTO</span> @PROFESOR</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">END</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">/*cerramos el cursor*/</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">CLOSE TODOS</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">DEALLOCATE TODOS </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Espero les ayude...nos vemos en otra ocación</p>
<p class="akst_link"><a target="_blank" href="http://www.scriptmatico.com/?p=37&amp;akst_action=share-this"  title="Comparte esta publicaci&oacute;n en technorati, meneame, etc." id="akst_link_37" class="akst_share_link" rel="nofollow">Comp&aacute;rtelo!</a>
</p><p align="left"><a target="_blank" class="tt" href="http://twitter.com/home/?status=Recorrer+Una+tabla+Con+T-SQL+usando+cursores+http://8r48d.th8.us" title="Enviar a Twitter"><img class="nothumb" src="http://www.scriptmatico.com/wp-content/plugins/tweet-this/icons/tt-twitter-big2.png" alt="Post to Twitter" /></a> <a target="_blank" class="tt" href="http://twitter.com/home/?status=Recorrer+Una+tabla+Con+T-SQL+usando+cursores+http://8r48d.th8.us" title="Enviar a Twitter">   </a></p>]]></content:encoded>
			<wfw:commentRss>http://www.scriptmatico.com/2007/08/13/recorrer-una-tabla-con-t-sql-usando-cursores/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Migrar de SQL server 2000 a MYSQL 4.0</title>
		<link>http://www.scriptmatico.com/2007/08/02/migrar-de-sql-server-2000-a-mysql-40/</link>
		<comments>http://www.scriptmatico.com/2007/08/02/migrar-de-sql-server-2000-a-mysql-40/#comments</comments>
		<pubDate>Thu, 02 Aug 2007 20:29:36 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[MYSQL]]></category>
		<category><![CDATA[SQL SERVER]]></category>

		<guid isPermaLink="false">http://www.exodo999.phpnet.us/?p=33</guid>
		<description><![CDATA[Bien esta vez me tope con la migracion de la base de datos de SQL server a MYSQL, la verdad que es muy facil, solo ay que seguir estos pasos:
Lo primero que hacemos es descargar el driver de la pagina de mysql, una vez descargado procederemos a instalarlo.

Cuando demos doble click en el instalador nos [...]]]></description>
			<content:encoded><![CDATA[<p>Bien esta vez me tope con la migracion de la base de datos de SQL server a MYSQL, la verdad que es muy facil, solo ay que seguir estos pasos:</p>
<p>Lo primero que hacemos es descargar el driver de la pagina de <a href="http://www.mysql.com">mysql</a>, una vez descargado procederemos a instalarlo.</p>
<p><a href='http://www.scriptmatico.com/wp-content/uploads/2007/08/pasouno.jpg' title='pasouno.JPG'><img src='http://www.scriptmatico.com/wp-content/uploads/2007/08/pasouno-150x150.jpg' alt='pasouno.JPG' /></a></p>
<p>Cuando demos doble click en el instalador nos aparecera una imagen como la de abajo, solo ay que seguir los pasos, no creo que les sea dificil instalarlo.</p>
<p><a href='http://www.scriptmatico.com/wp-content/uploads/2007/08/setup.jpg' title='setup.JPG'><img src='http://www.scriptmatico.com/wp-content/uploads/2007/08/setup-150x150.jpg' alt='setup.JPG' /></a></p>
<p>Bien ahora abriremos el administrador de consultas y damos clic derecho en la base de datos la cual vamos a querer migrar, luego en el menu buscamos en el que dice All Taks o Todas las tareas en español y damos click a Exportar Datos o Export.</p>
<p><a href='http://www.scriptmatico.com/wp-content/uploads/2007/08/pasodos.jpg' title='pasodos.JPG'><img src='http://www.scriptmatico.com/wp-content/uploads/2007/08/pasodos-150x150.jpg' alt='pasodos.JPG' /></a></p>
<p>Nos debe aparecer una ventana como la siguiente:</p>
<p><a href='http://www.scriptmatico.com/wp-content/uploads/2007/08/paso1.jpg' title='paso1.JPG'><img src='http://www.scriptmatico.com/wp-content/uploads/2007/08/paso1-150x150.jpg' alt='paso1.JPG' /></a></p>
<p>Bien demos click en siguiente y nos aparecera una ventana como la siguiente pidiendonos el origen de datos y escogeremos El Proveedor OLE para SQL que al parecer es el default.</p>
<p><a href='http://www.scriptmatico.com/wp-content/uploads/2007/08/orign.jpg' title='orign.JPG'><img src='http://www.scriptmatico.com/wp-content/uploads/2007/08/orign-150x150.jpg' alt='orign.JPG' /></a></p>
<p>Bien ahora le damos click en siguiente y nos mostrara la siguiente pantalla en la cual escojeremos el destino que seria Mysql ODBC driver.</p>
<p><a href='http://www.scriptmatico.com/wp-content/uploads/2007/08/dest.jpg' title='dest.JPG'><img src='http://www.scriptmatico.com/wp-content/uploads/2007/08/dest-150x150.jpg' alt='dest.JPG' /></a></p>
<p>Una vez seleccionado esto marcaremos la primera opcion que nos da por lo general es la default y damos click en el boton Nuevo, nos aparecera una ventana como la siguiente:</p>
<p><a href='http://www.scriptmatico.com/wp-content/uploads/2007/08/ns1.jpg' title='ns1.JPG'><img src='http://www.scriptmatico.com/wp-content/uploads/2007/08/ns1-150x150.jpg' alt='ns1.JPG' /></a></p>
<p>Damos click en siguiente y escogemos de la lista Mysql ODBC 3.51 Driver ahora damos click de nuevo a siguiente y Por ultimo en Finich o Finalizar.</p>
<p><a href='http://www.scriptmatico.com/wp-content/uploads/2007/08/ns2.jpg' title='ns2.JPG'><img src='http://www.scriptmatico.com/wp-content/uploads/2007/08/ns2-150x150.jpg' alt='ns2.JPG' /></a><a href='http://www.scriptmatico.com/wp-content/uploads/2007/08/ns3.jpg' title='ns3.JPG'><img src='http://www.scriptmatico.com/wp-content/uploads/2007/08/ns3-150x150.jpg' alt='ns3.JPG' /></a></p>
<p>Inmadiatamente nos aparecera la siguiente pantalla, solo la llenaremos con los datos correspondientes a nuestro servidor MYSQL y seleccionaremos la Base de datos que tomara por default para migrar. Podemos dar click en test para ver si nos conecta o dar click en OK para salir de ahi.</p>
<p><a href='http://www.scriptmatico.com/wp-content/uploads/2007/08/mysqldconf.jpg' title='mysqldconf.JPG'><img src='http://www.scriptmatico.com/wp-content/uploads/2007/08/mysqldconf-150x150.jpg' alt='mysqldconf.JPG' /></a></p>
<p>Continuando nos regresara a la pantalla del destino de datos con el data source que acabamos de crear.</p>
<p><a href='http://www.exodo999.phpnet.us/wp-content/pasf.JPG' title='pasf.JPG'><img src='http://www.exodo999.phpnet.us/wp-content/pasf.thumbnail.JPG' alt='pasf.JPG' /></a></p>
<p>Damos click en siguiente y nos aparecera una ventana con dos opciones habilitadas dejaremos la primera por default para copiar las tablas que seleccionemos, damos click en siguiente para seleccionar las tablas que vamos a migrar.</p>
<p><a href='http://www.scriptmatico.com/wp-content/uploads/2007/08/pasop.jpg' title='pasop.JPG'><img src='http://www.scriptmatico.com/wp-content/uploads/2007/08/pasop-150x150.jpg' alt='pasop.JPG' /></a></p>
<p>Seleccionamos las tablas como lo muestra la imagen. Y damos Click en siguiente.</p>
<p><a href='http://www.scriptmatico.com/wp-content/uploads/2007/08/pasoul.jpg' title='pasoul.JPG'><img src='http://www.scriptmatico.com/wp-content/uploads/2007/08/pasoul-150x150.jpg' alt='pasoul.JPG' /></a></p>
<p>La siguiente ventana nos permitira programar la migracion o realizarla inmediatamente, en este caso sera de inmediato damos click en siguiente y luego en finalizar. Cuando demos click en finalizar nos aparecera una ventana con el progreso y cuando termine mandara un mensage de que ha finalizado.</p>
<p><a href='http://www.scriptmatico.com/wp-content/uploads/2007/08/pasol.jpg' title='pasol.JPG'><img src='http://www.scriptmatico.com/wp-content/uploads/2007/08/pasol-150x150.jpg' alt='pasol.JPG' /></a><a href='http://www.scriptmatico.com/wp-content/uploads/2007/08/pasollll.jpg' title='pasollll.JPG'><img src='http://www.scriptmatico.com/wp-content/uploads/2007/08/pasollll-150x150.jpg' alt='pasollll.JPG' /></a></p>
<p>Espero que al que lea esto le sea de mucha utilidad y de algo sirva mi experiencia jeje.</p>
<p class="akst_link"><a target="_blank" href="http://www.scriptmatico.com/?p=33&amp;akst_action=share-this"  title="Comparte esta publicaci&oacute;n en technorati, meneame, etc." id="akst_link_33" class="akst_share_link" rel="nofollow">Comp&aacute;rtelo!</a>
</p><p align="left"><a target="_blank" class="tt" href="http://twitter.com/home/?status=Migrar+de+SQL+server+2000+a+MYSQL+4.0+http://k6pd3.th8.us" title="Enviar a Twitter"><img class="nothumb" src="http://www.scriptmatico.com/wp-content/plugins/tweet-this/icons/tt-twitter-big2.png" alt="Post to Twitter" /></a> <a target="_blank" class="tt" href="http://twitter.com/home/?status=Migrar+de+SQL+server+2000+a+MYSQL+4.0+http://k6pd3.th8.us" title="Enviar a Twitter">   </a></p>]]></content:encoded>
			<wfw:commentRss>http://www.scriptmatico.com/2007/08/02/migrar-de-sql-server-2000-a-mysql-40/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
