<?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>Pablo Viale &#187; SQL Server</title>
	<atom:link href="http://www.viale.mx/index.php/category/sql-server/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.viale.mx</link>
	<description>Consejos para diseño y desarrollo de aplicaciones web</description>
	<lastBuildDate>Wed, 29 Jun 2011 22:18:01 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>C&#243;mo darle formato a una fecha en SQL Server</title>
		<link>http://www.viale.mx/2010/06/15/como-darle-formato-a-una-fecha-en-sql-server/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=como-darle-formato-a-una-fecha-en-sql-server</link>
		<comments>http://www.viale.mx/2010/06/15/como-darle-formato-a-una-fecha-en-sql-server/#comments</comments>
		<pubDate>Tue, 15 Jun 2010 18:51:58 +0000</pubDate>
		<dc:creator>Pablo Viale</dc:creator>
				<category><![CDATA[SQL Server]]></category>

		<guid isPermaLink="false">http://www.viale.mx/?p=448</guid>
		<description><![CDATA[Para desplegar una fecha mostrando el formato utilizado en Latinoamérica, utiliza la siguiente instrucción: Clic para mostrar texto plano SQL: SELECT CONVERT&#40;VARCHAR&#40;10&#41;, TuTabla.Fecha, 103&#41; FROM TuTabla La fecha será desplegada en el formato dd/mm/aaaa, por ejemplo 15/06/2010 para el 15 de junio de 2010. Puedes encontrar la lista completa de los formatos en esta página.]]></description>
			<content:encoded><![CDATA[<p>Para desplegar una fecha mostrando el formato utilizado en Latinoamérica, utiliza la siguiente instrucción:</p>
<div class="igBar"><span id="lsql-2"><a href="#" onclick="javascript:showPlainTxt('sql-2'); return false;">Clic para mostrar texto plano</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;"><span style="color: #993333; font-weight: bold;">SELECT</span> CONVERT<span style="color:#006600; font-weight:bold;">&#40;</span>VARCHAR<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #cc66cc;color:#800000;">10</span><span style="color:#006600; font-weight:bold;">&#41;</span>, TuTabla.Fecha, <span style="color: #cc66cc;color:#800000;">103</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color: #993333; font-weight: bold;">FROM</span> TuTabla </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>La fecha será desplegada en el formato dd/mm/aaaa, por ejemplo 15/06/2010 para el 15 de junio de 2010.</p>
<p>Puedes encontrar la lista completa de los formatos <a href="http://www.sql-server-helper.com/tips/date-formats.aspx">en esta página</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.viale.mx/2010/06/15/como-darle-formato-a-una-fecha-en-sql-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Exclusive access could not be obtained because the database is in use</title>
		<link>http://www.viale.mx/2010/06/14/exclusive-access-could-not-be-obtained-because-the-database-is-in-use/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=exclusive-access-could-not-be-obtained-because-the-database-is-in-use</link>
		<comments>http://www.viale.mx/2010/06/14/exclusive-access-could-not-be-obtained-because-the-database-is-in-use/#comments</comments>
		<pubDate>Mon, 14 Jun 2010 23:34:27 +0000</pubDate>
		<dc:creator>Pablo Viale</dc:creator>
				<category><![CDATA[ASP.NET 2.0 / 3.5]]></category>
		<category><![CDATA[SQL Server]]></category>

		<guid isPermaLink="false">http://www.viale.mx/?p=441</guid>
		<description><![CDATA[Intentas restaurar una base de datos desde un backup utilizando Microsoft SQL Server Management Studio y te aparece el siguiente error: Restore failed for Server 'TuServidor'.&#160; (Microsoft.SqlServer.SmoExtended) System.Data.SqlClient.SqlError: Exclusive access could not be obtained because the database is in use. (Microsoft.SqlServer.Smo) Lo que ocurre es que la base de datos está abierta por otro proceso [...]]]></description>
			<content:encoded><![CDATA[<p>Intentas restaurar una base de datos desde un backup utilizando Microsoft SQL Server Management Studio y te aparece el siguiente error:</p>
<p>Restore failed for Server 'TuServidor'.&#160; (Microsoft.SqlServer.SmoExtended)</p>
<p>System.Data.SqlClient.SqlError: Exclusive access could not be obtained because the database is in use. (Microsoft.SqlServer.Smo)</p>
<p>Lo que ocurre es que la base de datos está abierta por otro proceso y debes cerrar todas las conexiones. Para hacerlo, abre una ventana de Query y coloca lo siguiente:</p>
<div class="igBar"><span id="lsql-4"><a href="#" onclick="javascript:showPlainTxt('sql-4'); return false;">Clic para mostrar texto plano</a></span></div>
<div class="syntax_hilite"><span class="langName">SQL:</span>
<div id="sql-4">
<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;"><span style="color: #993333; font-weight: bold;">USE</span> master</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">go</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;">ALTER</span> <span style="color: #993333; font-weight: bold;">DATABASE</span> nombre_de_tu_base_de_datos <span style="color: #993333; font-weight: bold;">SET</span> single_user <span style="color: #993333; font-weight: bold;">WITH</span> rollback immediate</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;">ALTER</span> <span style="color: #993333; font-weight: bold;">DATABASE</span> nombre_de_tu_base_de_datos <span style="color: #993333; font-weight: bold;">SET</span> multi_user </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Este script fue tomado de un <a href="http://geeks.ms/blogs/sergiotarrillo/archive/2007/07/28/23933.aspx">excelente post escrito por Sergio Tarrillo</a>, en el cual puedes encontrar soluciones adicionales para este problema.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.viale.mx/2010/06/14/exclusive-access-could-not-be-obtained-because-the-database-is-in-use/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Saving changes is not permitted en SQL Server</title>
		<link>http://www.viale.mx/2010/03/01/saving-changes-is-not-permitted-sql-server/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=saving-changes-is-not-permitted-sql-server</link>
		<comments>http://www.viale.mx/2010/03/01/saving-changes-is-not-permitted-sql-server/#comments</comments>
		<pubDate>Mon, 01 Mar 2010 16:43:03 +0000</pubDate>
		<dc:creator>Pablo Viale</dc:creator>
				<category><![CDATA[ASP.NET 2.0 / 3.5]]></category>
		<category><![CDATA[SQL Server]]></category>

		<guid isPermaLink="false">http://www.viale.mx/?p=397</guid>
		<description><![CDATA[Trabajando en una instalación limpia de SQL Server 2008, si intentas modificar la estructura de una tabla, puedes encontrarte este error al intentarla guardar: Saving changes is not permitted. The changes you have made require the following tables to be dropped and re-created. You have either made changes to a table that can't be re-created [...]]]></description>
			<content:encoded><![CDATA[<p>Trabajando en una instalación limpia de SQL Server 2008, si intentas modificar la estructura de una tabla, puedes encontrarte este error al intentarla guardar:</p>
<p><em>Saving changes is not permitted. The changes you have made require the following tables to be dropped and re-created. You have either made changes to a table that can't be re-created or enabled the option Prevent saving changes that require the table to be re-created.</em></p>
<p><a href="http://www.viale.mx/wp-content/uploads/2010/03/saving-not-permitted.gif"><img class="alignnone size-full wp-image-398" title="saving-not-permitted" src="http://www.viale.mx/wp-content/uploads/2010/03/saving-not-permitted.gif" alt="saving-not-permitted" width="455" height="365" /></a></p>
<p>Si oprimes <code>Cancel</code>, no se guarda ningún cambio.</p>
<p>La solución es muy sencilla, abre <em>Microsoft SQL Server Management Studio</em> y haz clic en el menú <em>Tools</em>, y luego en <em>Options</em>.</p>
<p>Después en la columna izquierda selecciona <em>Designers</em> y desmarca la casilla <em>Prevent saving changes that require table re-creation</em>.</p>
<p><a href="http://www.viale.mx/wp-content/uploads/2010/03/prevent.gif"><img class="alignnone size-full wp-image-399" title="prevent" src="http://www.viale.mx/wp-content/uploads/2010/03/prevent.gif" alt="prevent" width="644" height="375" /></a></p>
<p>Y listo, ahora podrás modificar tu tabla y guardar los cambios.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.viale.mx/2010/03/01/saving-changes-is-not-permitted-sql-server/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>User, group, or role already exists in the current database.</title>
		<link>http://www.viale.mx/2010/01/08/user-group-or-role-already-exists-in-the-current-database/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=user-group-or-role-already-exists-in-the-current-database</link>
		<comments>http://www.viale.mx/2010/01/08/user-group-or-role-already-exists-in-the-current-database/#comments</comments>
		<pubDate>Fri, 08 Jan 2010 23:20:57 +0000</pubDate>
		<dc:creator>Pablo Viale</dc:creator>
				<category><![CDATA[ASP.NET 2.0 / 3.5]]></category>
		<category><![CDATA[SQL Server]]></category>

		<guid isPermaLink="false">http://www.viale.mx/?p=376</guid>
		<description><![CDATA[Seguramente te ha pasado que al migrar una base de datos de SQL Server de un servidor a otro, haces tu backup usando Microsoft SQL Server Management Studio, transfieres el archivo, y haces el restore en el nuevo servidor. Todo parece perfecto, pero cuando vas a crear tu usuario obtienes el siguiente error: User, group, [...]]]></description>
			<content:encoded><![CDATA[<p>Seguramente te ha pasado que al <a href="/2008/04/11/como-restaurar-una-base-de-datos-de-sql-server-en-otro-servidor/">migrar una base de datos de SQL Server de un servidor a otro</a>, haces tu backup usando <code>Microsoft SQL Server Management Studio</code>, transfieres el archivo, y haces el restore en el nuevo servidor.  Todo parece perfecto, pero cuando vas a crear tu usuario obtienes el siguiente error:</p>
<p><a href="http://www.viale.mx/wp-content/uploads/2010/01/error1.gif"><img src="http://www.viale.mx/wp-content/uploads/2010/01/error1.gif" alt="error1" title="error1" width="621" height="209" class="alignnone size-full wp-image-377" /></a></p>
<p><code>User, group, or role '' already exists in the current database. (Microsoft SQL Server, Error: 15023)</code></p>
<p>Entonces expandes tu base de datos, vas al nodo Security -> Users ->, buscas el usuario, y lo intentas borrar, pero entonces aparece otro error:</p>
<p><a href="http://www.viale.mx/wp-content/uploads/2010/01/error2.gif"><img src="http://www.viale.mx/wp-content/uploads/2010/01/error2.gif" alt="error2" title="error2" width="621" height="209" class="alignnone size-full wp-image-378" /></a></p>
<p><code>Drop failed for User ''.  (Microsoft.SqlServer.Smo). The database principal owns a database role and cannot be dropped. (Microsoft SQL Server, Error: 15421)</code></p>
<p>En este punto te das cuenta de que el usuario está "huérfano" (orphaned), y una solución para darle la vuelta al problema es crear un nuevo usuario con otro nombre, asignarlo a la base de datos, y modificar el nombre del usuario en el <code>Connection String</code> de tu aplicación.</p>
<p>Pero existe una manera de solucionar las cosas correcta y fácilmente.</p>
<p>Abre una ventana de <code>query</code> en tu base de datos y teclea lo siguiente para ver los usuarios huérfanos:</p>
<div class="igBar"><span id="lsql-8"><a href="#" onclick="javascript:showPlainTxt('sql-8'); return false;">Clic para mostrar texto plano</a></span></div>
<div class="syntax_hilite"><span class="langName">SQL:</span>
<div id="sql-8">
<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;">EXEC sp_change_users_login <span style="color: #ff0000;">'Report'</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Si ves a tu usuario ahí significa que efectivamente está huérfano y para deshuerfanizarlo <img src='http://www.viale.mx/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  teclea lo siguiente:</p>
<div class="igBar"><span id="lsql-9"><a href="#" onclick="javascript:showPlainTxt('sql-9'); return false;">Clic para mostrar texto plano</a></span></div>
<div class="syntax_hilite"><span class="langName">SQL:</span>
<div id="sql-9">
<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;">EXEC sp_change_users_login <span style="color: #ff0000;">'Auto_Fix'</span>, <span style="color: #ff0000;">'user'</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Modificando <code>user</code> por el nombre de tu usuario.</p>
<p>Y listo, asunto totalmente solucionado, no tienes que crear nuevos usuarios ni modificar las <code>Connection Strings</code> de tus aplicaciones.</p>
<p>Por último, si quieres crear un nuevo usuario para esta base de datos, usa:</p>
<div class="igBar"><span id="lsql-10"><a href="#" onclick="javascript:showPlainTxt('sql-10'); return false;">Clic para mostrar texto plano</a></span></div>
<div class="syntax_hilite"><span class="langName">SQL:</span>
<div id="sql-10">
<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;">EXEC sp_change_users_login <span style="color: #ff0000;">'Auto_Fix'</span>, <span style="color: #ff0000;">'user'</span>, <span style="color: #ff0000;">'login'</span>, <span style="color: #ff0000;">'password'</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Referencia: <a href="http://stupidprogrammer.com/2009/02/20/user-already-exists-in-the-current-database/">Stupid Programmer</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.viale.mx/2010/01/08/user-group-or-role-already-exists-in-the-current-database/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Palabras reservadas de SQL Server 2005</title>
		<link>http://www.viale.mx/2008/08/21/palabras-reservadas-de-sql-server-2005/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=palabras-reservadas-de-sql-server-2005</link>
		<comments>http://www.viale.mx/2008/08/21/palabras-reservadas-de-sql-server-2005/#comments</comments>
		<pubDate>Thu, 21 Aug 2008 20:07:00 +0000</pubDate>
		<dc:creator>Pablo Viale</dc:creator>
				<category><![CDATA[SQL Server]]></category>

		<guid isPermaLink="false">http://www.viale.com.mx/2008/08/21/palabras-reservadas-de-sql-server-2005/</guid>
		<description><![CDATA[Las siguientes palabras son palabras reservadas (Reserved Keywords) para SQL Server 2005. Si vas a crear una tabla, columna, o algún otro elemento en tu base de datos, trata de no utilizar alguna de las siguientes palabras. Si por alguna razón lo haces, deberás utilizar los delimitadores "[" y "]" en tus sentencias. Por ejemplo, [...]]]></description>
			<content:encoded><![CDATA[<p>Las siguientes palabras son palabras reservadas (Reserved Keywords) para SQL Server 2005.  Si vas a crear una tabla, columna, o algún otro elemento en tu base de datos, trata de no utilizar alguna de las siguientes palabras.  Si por alguna razón lo haces, deberás utilizar los delimitadores "[" y "]" en tus sentencias.</p>
<p>Por ejemplo, si creas una tabla llamada <code>Abort</code> utilízala como sigue:</p>
<div class="igBar"><span id="lsql-12"><a href="#" onclick="javascript:showPlainTxt('sql-12'); return false;">Clic para mostrar texto plano</a></span></div>
<div class="syntax_hilite"><span class="langName">SQL:</span>
<div id="sql-12">
<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;"><span style="color: #993333; font-weight: bold;">SELECT</span> * <span style="color: #993333; font-weight: bold;">FROM</span> <span style="color:#006600; font-weight:bold;">&#91;</span>Abort<span style="color:#006600; font-weight:bold;">&#93;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>De lo contrario, generarás un error.</p>
<p>Las palabras reservadas son:</p>
<p>A<br />
ABORT<br />
ABS<br />
ABSOLUTE<br />
ACCESS<br />
ACOS<br />
ACQUIRE<br />
ACTION<br />
ACTIVATE<br />
ADA<br />
ADD<br />
ADDFORM<br />
ADMIN<br />
AFTER<br />
AGGREGATE<br />
ALIAS<br />
ALL<br />
ALLOCATE<br />
ALTER<br />
AN<br />
ANALYZE<br />
AND<br />
ANY<br />
APPEND<br />
ARCHIVE<br />
ARCHIVELOG<br />
ARE<br />
ARRAY<br />
ARRAYLEN<br />
AS<br />
ASC<br />
ASCII<br />
ASIN<br />
ASSERTION<br />
AT<br />
ATAN<br />
AUDIT<br />
AUTHORIZATION<br />
AVG<br />
AVGU<br />
BACKUP<br />
BECOME<br />
BEFORE<br />
BEGIN<br />
BETWEEN<br />
BIGINT<br />
BINARY<br />
BIND<br />
BINDING<br />
BIT<br />
BLOB<br />
BLOCK<br />
BODY<br />
BOOLEAN<br />
BOTH<br />
BREADTH<br />
BREAK<br />
BREAKDISPLAY<br />
BROWSE<br />
BUFFERPOOL<br />
BULK<br />
BY<br />
BYREF<br />
CACHE<br />
CALL<br />
CALLPROC<br />
CANCEL<br />
CAPTURE<br />
CASCADE<br />
CASCADED<br />
CASE<br />
CAST<br />
CATALOG<br />
CCSID<br />
CEILING<br />
CHANGE<br />
CHAR<br />
CHARACTER<br />
CHARTOROWID<br />
CHECK<br />
CLASS<br />
CLOB<br />
CHECKPOINT<br />
CHR<br />
CLEANUP<br />
CLEAR<br />
CLEARROW<br />
CLOSE<br />
CLUSTER<br />
CLUSTERED<br />
COALESCE<br />
COBOL<br />
COLGROUP<br />
COLLATE<br />
COLLATION<br />
COLLECTION<br />
COLUMN<br />
COMMAND<br />
COMMENT<br />
COMMIT<br />
COMPLETION<br />
COMMITTED<br />
COMPILE<br />
COMPLEX<br />
COMPRESS<br />
COMPUTE<br />
CONCAT<br />
CONFIRM<br />
CONNECT<br />
CONNECTION<br />
CONSTRAINT<br />
CONSTRAINTS<br />
CONSTRUCTOR<br />
CONTAINS<br />
CONTAINSTABLE<br />
CONTENTS<br />
CONTINUE<br />
CONTROLFILE<br />
CONTROLROW<br />
CONVERT<br />
COPY<br />
CORRESPONDING<br />
COS<br />
COUNT<br />
COUNTU<br />
CREATE<br />
CROSS<br />
CUBE<br />
CURRENT<br />
CURRENT_DATE<br />
CURRENT_PATH<br />
CURRENT_ROLE<br />
CURRENT_TIME<br />
CURRENT_TIMESTAMP<br />
CURRENT_USER<br />
CURSOR<br />
CVAR<br />
CYCLE<br />
DATA<br />
DATABASE<br />
DATAFILE<br />
DATAHANDLER<br />
DATAPAGES<br />
DATE<br />
DAY<br />
DAYOFMONTH<br />
DAYOFWEEK<br />
DAYOFYEAR<br />
DAYS<br />
DBA<br />
DBCC<br />
DBSPACE<br />
DEALLOCATE<br />
DEC<br />
DECIMAL<br />
DECLARATION<br />
DECLARE<br />
DECODE<br />
DEFAULT<br />
DEFERRABLE<br />
DEFERRED<br />
DEFINE<br />
DEFINITION<br />
DEGREES<br />
DELETE<br />
DEPTH<br />
DEREF<br />
DELETEROW<br />
DENY<br />
DESC<br />
DESCRIBE<br />
DESCRIPTOR<br />
DESTROY<br />
DHTYPE<br />
DESTRUCTOR<br />
DETERMINISTIC<br />
DICTIONARY<br />
DIAGNOSTICS<br />
DIRECT<br />
DISABLE<br />
DISCONNECT<br />
DISK<br />
DISMOUNT<br />
DISPLAY<br />
DISTINCT<br />
DISTRIBUTE<br />
DISTRIBUTED<br />
DO<br />
DOMAIN<br />
DOUBLE<br />
DOWN<br />
DROP<br />
DUMMY<br />
DUMP<br />
DYNAMIC<br />
EACH<br />
EDITPROC<br />
ELSE<br />
ELSEIF<br />
ENABLE<br />
END<br />
ENDDATA<br />
ENDDISPLAY<br />
ENDEXEC<br />
END-EXEC<br />
ENDFORMS<br />
ENDIF<br />
ENDLOOP<br />
EQUALS<br />
ENDSELECT<br />
ENDWHILE<br />
ERASE<br />
ERRLVL<br />
ERROREXIT<br />
ESCAPE<br />
EVENTS<br />
EVERY<br />
EXCEPT<br />
EXCEPTION<br />
EXCEPTIONS<br />
EXCLUDE<br />
EXCLUDING<br />
EXCLUSIVE<br />
EXEC<br />
EXECUTE<br />
EXISTS<br />
EXIT<br />
EXP<br />
EXPLAIN<br />
EXPLICIT<br />
EXTENT<br />
EXTERNAL<br />
EXTERNALLY<br />
EXTRACT<br />
FALSE<br />
FETCH<br />
FIELD<br />
FIELDPROC<br />
FILE<br />
FILLFACTOR<br />
FINALIZE<br />
FINALIZE<br />
FIRST<br />
FLOAT<br />
FLOOR<br />
FLOPPY<br />
FLUSH<br />
FOR<br />
FORCE<br />
FORMDATA<br />
FORMINIT<br />
FORMS<br />
FORTRAN<br />
FOREIGN<br />
FOUND<br />
FREELIST<br />
FREELISTS<br />
FREETEXT<br />
FREETEXTTABLE<br />
FROM<br />
FREE<br />
FULL<br />
FUNCTION<br />
GENERAL<br />
GET<br />
GETCURRENTCONNECTION<br />
GETFORM<br />
GETOPER<br />
GETROW<br />
GLOBAL<br />
GO<br />
GOTO<br />
GRANT<br />
GRANTED<br />
GRAPHIC<br />
GREATEST<br />
GROUP<br />
GROUPING<br />
GROUPS<br />
HASH<br />
HAVING<br />
HOST<br />
HELP<br />
HELPFILE<br />
HOLDLOCK<br />
HOUR<br />
HOURS<br />
IDENTIFIED<br />
IDENTITY<br />
IGNORE<br />
IDENTITYCOL<br />
IF<br />
IFNULL<br />
IIMESSAGE<br />
IIPRINTF<br />
IMMEDIATE<br />
IMPORT<br />
IN<br />
INCLUDE<br />
INCLUDING<br />
INCREMENT<br />
INDEX<br />
INDEXPAGES<br />
INDICATOR<br />
INITCAP<br />
INITIAL<br />
INITIALIZE<br />
INITIALLY<br />
INITRANS<br />
INITTABLE<br />
INNER<br />
INOUT<br />
INPUT<br />
INSENSITIVE<br />
INSERT<br />
INSERTROW<br />
INSTANCE<br />
INSTR<br />
INT<br />
INTEGER<br />
INTEGRITY<br />
INTERFACE<br />
INTERSECT<br />
INTERVAL<br />
INTO<br />
IS<br />
ISOLATION<br />
ITERATE<br />
JOIN<br />
KEY<br />
KILL<br />
LABEL<br />
LANGUAGE<br />
LARGE<br />
LAST<br />
LATERAL<br />
LAYER<br />
LEADING<br />
LEAST<br />
LEFT<br />
LESS<br />
LENGTH<br />
LEVEL<br />
LIKE<br />
LIMIT<br />
LINENO<br />
LINK<br />
LIST<br />
LISTS<br />
LOAD<br />
LOADTABLE<br />
LOCAL<br />
LOCALTIME<br />
LOCALTIMESTAMP<br />
LOCATOR<br />
LOCATE<br />
LOCK<br />
LOCKSIZE<br />
LOG<br />
LOGFILE<br />
LONG<br />
LONGINT<br />
LOWER<br />
LPAD<br />
LTRIM<br />
LVARBINARY<br />
LVARCHAR<br />
MAIN<br />
MANAGE<br />
MANUAL<br />
MAP<br />
MATCH<br />
MAX<br />
MAXDATAFILES<br />
MAXEXTENTS<br />
MAXINSTANCES<br />
MAXLOGFILES<br />
MAXLOGHISTORY<br />
MAXLOGMEMBERS<br />
MAXTRANS<br />
MAXVALUE<br />
MENUITEM<br />
MESSAGE<br />
MICROSECOND<br />
MICROSECONDS<br />
MIN<br />
MINEXTENTS<br />
MINUS<br />
MINUTE<br />
MODIFIES<br />
MINUTES<br />
MINVALUE<br />
MIRROREXIT<br />
MOD<br />
MODE<br />
MODIFY<br />
MODULE<br />
MONEY<br />
MONTH<br />
MONTHS<br />
MOUNT<br />
MOVE<br />
NAMED<br />
NAMES<br />
NATIONAL<br />
NATURAL<br />
NCHAR<br />
NCLOB<br />
NEW<br />
NEXT<br />
NHEADER<br />
NO<br />
NOARCHIVELOG<br />
NOAUDIT<br />
NOCACHE<br />
NOCHECK<br />
NOCOMPRESS<br />
NOCYCLE<br />
NOECHO<br />
NOMAXVALUE<br />
NOMINVALUE<br />
NONCLUSTERED<br />
NONE<br />
NOORDER<br />
NORESETLOGS<br />
NORMAL<br />
NOSORT<br />
NOT<br />
NOTFOUND<br />
NOTRIM<br />
NOWAIT<br />
NULL<br />
NULLIF<br />
NULLVALUE<br />
NUMBER<br />
NUMERIC<br />
OBJECT<br />
NUMPARTS<br />
NVL<br />
OBID<br />
ODBCINFO<br />
OF<br />
OFF<br />
OFFLINE<br />
OFFSETS<br />
OLD<br />
ON<br />
ONCE<br />
ONLINE<br />
ONLY<br />
OPEN<br />
OPERATION<br />
OPENDATASOURCE<br />
OPENQUERY<br />
OPENROWSET<br />
OPTIMAL<br />
OPTIMIZE<br />
OPTION<br />
OR<br />
ORDER<br />
ORDINALITY<br />
OUT<br />
OUTER<br />
OUTPUT<br />
OVER<br />
OVERLAPS<br />
OWN<br />
PACKAGE<br />
PAD<br />
PARAMETER<br />
PARAMETERS<br />
PAGE<br />
PAGES<br />
PARALLEL<br />
PART<br />
PARTIAL<br />
PATH<br />
POSTFIX<br />
PASCAL<br />
PCTFREE<br />
PCTINCREASE<br />
PCTINDEX<br />
PCTUSED<br />
PERCENT<br />
PERM<br />
PERMANENT<br />
PERMIT<br />
PI<br />
PIPE<br />
PLAN<br />
PLI<br />
POSITION<br />
POWER<br />
PRECISION<br />
PREFIX<br />
PREORDER<br />
PREPARE<br />
PRESERVE<br />
PRIMARY<br />
PRINT<br />
PRINTSCREEN<br />
PRIOR<br />
PRIQTY<br />
PRIVATE<br />
PRIVILEGES<br />
PROC<br />
PROCEDURE<br />
PROCESSEXIT<br />
PROFILE<br />
PROGRAM<br />
PROMPT<br />
PUBLIC<br />
PUTFORM<br />
PUTOPER<br />
PUTROW<br />
QUALIFICATION<br />
QUARTER<br />
QUOTA<br />
RADIANS<br />
RAISE<br />
RAISERROR<br />
RAND<br />
RANGE<br />
RAW<br />
READ<br />
READS<br />
READTEXT<br />
REAL<br />
RECURSIVE<br />
REF<br />
RECONFIGURE<br />
RECORD<br />
RECOVER<br />
REDISPLAY<br />
REFERENCES<br />
REFERENCING<br />
RELATIVE<br />
REGISTER<br />
RELEASE<br />
RELOCATE<br />
REMOVE<br />
RENAME<br />
REPEAT<br />
REPEATABLE<br />
REPEATED<br />
REPLACE<br />
REPLICATE<br />
REPLICATION<br />
RESET<br />
RESETLOGS<br />
RESOURCE<br />
RESTORE<br />
RESTRICT<br />
RESULT<br />
RESTRICTED<br />
RESUME<br />
RETRIEVE<br />
RETURN<br />
RETURNS<br />
REUSE<br />
REVOKE<br />
RIGHT<br />
ROLE<br />
ROLES<br />
ROLLBACK<br />
ROLLUP<br />
ROUTINE<br />
ROW<br />
ROWS<br />
ROWCOUNT<br />
ROWGUIDCOL<br />
ROWID<br />
ROWIDTOCHAR<br />
ROWLABEL<br />
ROWNUM<br />
ROWS<br />
RPAD<br />
RRN<br />
RTRIM<br />
RULE<br />
RUN<br />
RUNTIMESTATISTICS<br />
SAVE<br />
SAVEPOINT<br />
SCHEDULE<br />
SCHEMA<br />
SCN<br />
SCREEN<br />
SCROLL<br />
SCOPE<br />
SEARCH<br />
SCROLLDOWN<br />
SCROLLUP<br />
SECOND<br />
SECONDS<br />
SECQTY<br />
SECTION<br />
SEGMENT<br />
SELECT<br />
SEQUENCE<br />
SERIALIZABLE<br />
SERVICE<br />
SESSION<br />
SESSION_USER<br />
SET<br />
SETS<br />
SETUSER<br />
SIN<br />
SIMPLE<br />
SIGN<br />
SHUTDOWN<br />
SHORT<br />
SHARE<br />
SHARED<br />
SETUSER<br />
SIZE<br />
SLEEP<br />
SMALLINT<br />
SNAPSHOT<br />
SOME<br />
SORT<br />
SOUNDEX<br />
SPACE<br />
SPECIFIC<br />
SPECIFICTYPE<br />
SQL<br />
SQLEXCEPTION<br />
SQLBUF<br />
SQLCA<br />
SQLCODE<br />
SQLERROR<br />
SQLSTATE<br />
SQLWARNING<br />
SQRT<br />
START<br />
STATE<br />
STATEMENT<br />
STATIC<br />
STRUCTURE<br />
STATISTICS<br />
STOGROUP<br />
STOP<br />
STORAGE<br />
STORPOOL<br />
SUBMENU<br />
SUBPAGES<br />
SUBSTR<br />
SUBSTRING<br />
SUCCESSFUL<br />
SUFFIX<br />
SUM<br />
SYSTEM_USER<br />
SUMU<br />
SWITCH<br />
SYNONYM<br />
SYSCAT<br />
SYSDATE<br />
SYSFUN<br />
SYSIBM<br />
SYSSTAT<br />
SYSTEM<br />
SYSTIME<br />
SYSTIMESTAMP<br />
TABLE<br />
TABLEDATA<br />
TABLES<br />
TABLESPACE<br />
TAN<br />
TAPE<br />
TEMP<br />
TEMPORARY<br />
TERMINATE<br />
THAN<br />
TEXTSIZE<br />
THEN<br />
THREAD<br />
TIME<br />
TIMEOUT<br />
TIMESTAMP<br />
TIMEZONE_HOUR<br />
TIMEZONE_MINUTE<br />
TINYINT<br />
TO<br />
TOP<br />
TPE<br />
TRACING<br />
TRAILING<br />
TRAN<br />
TRANSACTION<br />
TRANSLATE<br />
TRANSLATION<br />
TREAT<br />
TRIGGER<br />
TRIGGERS<br />
TRIM<br />
TRUE<br />
TRUNCATE<br />
TSEQUAL<br />
TYPE<br />
UID<br />
UNCOMMITTED<br />
UNDER<br />
UNION<br />
UNIQUE<br />
UNKNOWN<br />
UNNEST<br />
UNLIMITED<br />
UNLOADTABLE<br />
UNSIGNED<br />
UNTIL<br />
UP<br />
UPDATE<br />
UPDATETEXT<br />
UPPER<br />
USAGE<br />
USE<br />
USER<br />
USING<br />
UUID<br />
VALIDATE<br />
VALIDPROC<br />
VALIDROW<br />
VALUE<br />
VALUES<br />
VARBINARY<br />
VARCHAR<br />
VARIABLE<br />
VARIABLES<br />
VARYING<br />
VCAT<br />
VERSION<br />
VIEW<br />
VOLUMES<br />
WAITFOR<br />
WEEK<br />
WHEN<br />
WHENEVER<br />
WHERE<br />
WHILE<br />
WITH<br />
WITHOUT<br />
WORK<br />
WRITE<br />
WRITETEXT<br />
YEAR<br />
YEARS<br />
ZONE</p>
]]></content:encoded>
			<wfw:commentRss>http://www.viale.mx/2008/08/21/palabras-reservadas-de-sql-server-2005/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Cómo restablecer el valor de una columna Identity en SQL Server</title>
		<link>http://www.viale.mx/2008/04/23/como-restablecer-el-valor-de-una-columna-identity-en-sql-server/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=como-restablecer-el-valor-de-una-columna-identity-en-sql-server</link>
		<comments>http://www.viale.mx/2008/04/23/como-restablecer-el-valor-de-una-columna-identity-en-sql-server/#comments</comments>
		<pubDate>Wed, 23 Apr 2008 16:44:17 +0000</pubDate>
		<dc:creator>Pablo Viale</dc:creator>
				<category><![CDATA[SQL Server]]></category>

		<guid isPermaLink="false">http://www.viale.com.mx/2008/04/23/como-restablecer-el-valor-de-una-columna-identity-en-sql-server/</guid>
		<description><![CDATA[Las columnas marcadas como Identity en SQL Server van incrementando de acuerdo a una seed o semilla. Normalmente empiezan en 1 y van incrementando de 1 en 1. Si has insertado, por ejemplo, 20 registros, el valor del Identity será 21. Si eliminas todos los registros e insertas uno nuevo, verás que en vez de [...]]]></description>
			<content:encoded><![CDATA[<p>Las columnas marcadas como <code>Identity</code> en SQL Server van incrementando de acuerdo a una <code>seed</code> o semilla.  Normalmente empiezan en 1 y van incrementando de 1 en 1.  Si has insertado, por ejemplo, 20 registros, el valor del <code>Identity</code> será 21.  Si eliminas todos los registros e insertas uno nuevo, verás que en vez de empezar nuevamente del 1, continuará en el 21.</p>
<p>Hay ocasiones en las que necesitamos que el <code>Identity</code> vuelva a empezar en 1.  Para esto, se necesita restablecer la semilla, lo cual se llama <code>reseed</code>.</p>
<p>Todos los procedimientos siguientes utilizan el comando <code>DBCC</code> y se hacen mediante tu editor de consultas (<code>queries</code>) favorito, por ejemplo Microsoft SQL Server Management Studio.</p>
<p><strong>Para verificar el valor de la semilla ó seed</strong></p>
<div class="igBar"><span id="lsql-16"><a href="#" onclick="javascript:showPlainTxt('sql-16'); return false;">Clic para mostrar texto plano</a></span></div>
<div class="syntax_hilite"><span class="langName">SQL:</span>
<div id="sql-16">
<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;">DBCC checkident <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #ff0000;">'NombreDeTabla'</span><span style="color:#006600; font-weight:bold;">&#41;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Resultado:<br />
<code>Checking identity information: current identity value '20', current column value '20'.</code></p>
<p><strong>Para reparar la semilla ó seed</strong><br />
Si por alguna extraña razón la semilla se corrompe, puedes repararla con el siguiente comando, el cual modificará el valor de la semilla al valor máximo que se encuentre almacenado en la columna <code>Identity</code>.</p>
<div class="igBar"><span id="lsql-17"><a href="#" onclick="javascript:showPlainTxt('sql-17'); return false;">Clic para mostrar texto plano</a></span></div>
<div class="syntax_hilite"><span class="langName">SQL:</span>
<div id="sql-17">
<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;">DBCC checkident <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #ff0000;">'NombreDeTabla'</span>, reseed<span style="color:#006600; font-weight:bold;">&#41;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Resultado:<br />
<code>Checking identity information: current identity value '20', current column value '20'.</code></p>
<p><strong>Restablecer la semilla ó seed</strong><br />
Como comentaba al principio, si borraste todos los registros y necesitas reiniciar la semilla en 1, entonces emite el siguiente comando:</p>
<div class="igBar"><span id="lsql-18"><a href="#" onclick="javascript:showPlainTxt('sql-18'); return false;">Clic para mostrar texto plano</a></span></div>
<div class="syntax_hilite"><span class="langName">SQL:</span>
<div id="sql-18">
<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;">DBCC checkident <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #ff0000;">'NombreDeTabla'</span>, reseed, <span style="color: #cc66cc;color:#800000;">1</span><span style="color:#006600; font-weight:bold;">&#41;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Resultado:<br />
<code>Checking identity information: current identity value '20', current column value '1'.</code></p>
<p>Listo, el registro siguiente que insertes tendrá un valor <code>Identity</code> de 1.<br />
Puedes modificar el valor 1 a cualquier otro valor que necesites en el ejemplo del último comando.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.viale.mx/2008/04/23/como-restablecer-el-valor-de-una-columna-identity-en-sql-server/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Cómo insertar valores en columnas Identity</title>
		<link>http://www.viale.mx/2008/04/15/como-insertar-valores-en-columnas-identity/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=como-insertar-valores-en-columnas-identity</link>
		<comments>http://www.viale.mx/2008/04/15/como-insertar-valores-en-columnas-identity/#comments</comments>
		<pubDate>Wed, 16 Apr 2008 04:28:16 +0000</pubDate>
		<dc:creator>Pablo Viale</dc:creator>
				<category><![CDATA[SQL Server]]></category>

		<guid isPermaLink="false">http://www.viale.com.mx/2008/04/15/como-insertar-valores-en-columnas-identity/</guid>
		<description><![CDATA[Si intentas insertar (mediante algún software de sincronización de bases de datos o cualquier otro método) valores explícitos en columnas marcadas como Identity, obtendrás este error: Cannot insert explicit value for identity column in table 'MiTabla' when IDENTITY_INSERT is set to OFF Para poder insertar valores específicos en estas columnas, antes de realizar la inserción, [...]]]></description>
			<content:encoded><![CDATA[<p>Si intentas insertar (mediante algún software de sincronización de bases de datos o cualquier otro método) valores explícitos en columnas marcadas como <code>Identity</code>, obtendrás este error:</p>
<p><code>Cannot insert explicit value for identity column in table 'MiTabla' when IDENTITY_INSERT is set to OFF</code></p>
<p>Para poder insertar valores específicos en estas columnas, antes de realizar la inserción, corre esta sentencia SQL:</p>
<div class="igBar"><span id="lsql-21"><a href="#" onclick="javascript:showPlainTxt('sql-21'); return false;">Clic para mostrar texto plano</a></span></div>
<div class="syntax_hilite"><span class="langName">SQL:</span>
<div id="sql-21">
<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;"><span style="color: #993333; font-weight: bold;">SET</span> IDENTITY_INSERT MiTabla <span style="color: #993333; font-weight: bold;">ON</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Corre tu proceso de sincronización o inserción de datos, y no olvides al finalizar regresar la propiedad a su valor inicial, corriendo esta sentencia:</p>
<div class="igBar"><span id="lsql-22"><a href="#" onclick="javascript:showPlainTxt('sql-22'); return false;">Clic para mostrar texto plano</a></span></div>
<div class="syntax_hilite"><span class="langName">SQL:</span>
<div id="sql-22">
<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;"><span style="color: #993333; font-weight: bold;">SET</span> IDENTITY_INSERT MiTabla OFF </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
]]></content:encoded>
			<wfw:commentRss>http://www.viale.mx/2008/04/15/como-insertar-valores-en-columnas-identity/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cómo restaurar una base de datos de SQL Server en otro servidor</title>
		<link>http://www.viale.mx/2008/04/11/como-restaurar-una-base-de-datos-de-sql-server-en-otro-servidor/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=como-restaurar-una-base-de-datos-de-sql-server-en-otro-servidor</link>
		<comments>http://www.viale.mx/2008/04/11/como-restaurar-una-base-de-datos-de-sql-server-en-otro-servidor/#comments</comments>
		<pubDate>Sat, 12 Apr 2008 03:00:02 +0000</pubDate>
		<dc:creator>Pablo Viale</dc:creator>
				<category><![CDATA[SQL Server]]></category>

		<guid isPermaLink="false">http://www.viale.com.mx/2008/04/11/como-restaurar-una-base-de-datos-de-sql-server-en-otro-servidor/</guid>
		<description><![CDATA[Hace poco tuve que hacer un backup de una base de datos de SQL Server y restaurarla (restore) en otro servidor distinto. Para hacer el respaldo (backup) en el servidor de origen, usando Microsoft SQL Server Management Studio Express, haces clic con el botón derecho en la base de datos y seleccionas Tasks -> Back [...]]]></description>
			<content:encoded><![CDATA[<p>Hace poco tuve que hacer un backup de una base de datos de SQL Server y restaurarla (restore) en otro servidor distinto.</p>
<p>Para hacer el respaldo (backup) en el servidor de origen, usando Microsoft SQL Server Management Studio Express, haces clic con el botón derecho en la base de datos y seleccionas <code>Tasks -> Back Up...</code></p>
<p><a href='http://www.viale.com.mx/wp-content/uploads/2008/04/backup.gif' title='backup.gif'><img src='http://www.viale.com.mx/wp-content/uploads/2008/04/backup.gif' alt='backup.gif' /></a></p>
<p>Luego en la pantalla que aparece, seleccionas el tipo de backup llamado <code>Full</code>.</p>
<p><a href='http://www.viale.com.mx/wp-content/uploads/2008/04/backupoptions2bis2.gif' title='backupoptions2bis2.gif'><img src='http://www.viale.com.mx/wp-content/uploads/2008/04/backupoptions2bis2.gif' alt='backupoptions2bis2.gif' /></a></p>
<p>El archivo de respaldo quedará guardado en la ruta que aparece bajo el titulo <code>Destination</code>.</p>
<p>Ahora descarga ese archivo al servidor donde vas a restaurar la base de datos.  Por cierto, ya tiene que existir la base de datos (aunque esté vacía) para que puedas restaurar la información.</p>
<p>Ahora conectado al servidor destino, haz clic en la base de datos donde deseas vaciar la información y haz clic con el botón derecho y selecciona <code>Tasks -> Restore -> Database...</code></p>
<p><a href='http://www.viale.com.mx/wp-content/uploads/2008/04/restore.gif' title='restore.gif'><img src='http://www.viale.com.mx/wp-content/uploads/2008/04/restore.gif' alt='restore.gif' /></a></p>
<p>Selecciona la opción <code>From device</code>, haz clic en el botón con los tres puntitos, selecciona el archivo que descargaste y verás esta pantalla (asegúrate de marcar la casilla bajo <code>Restore</code>):</p>
<p><a href='http://www.viale.com.mx/wp-content/uploads/2008/04/restore3bis.gif' title='restore3bis.gif'><img src='http://www.viale.com.mx/wp-content/uploads/2008/04/restore3bis.gif' alt='restore3bis.gif' /></a></p>
<p>Ahora haz clic en <code>Ok</code>.</p>
<p>Si ves el siguiente error:</p>
<p><code>Error 3154: The backup set holds a backup of a database other than the existing 'xxxx' database</code></p>
<p>entonces haz clic en la página <code>Options</code> en el panel izquierdo y marca la casilla <code>Overwrite the existing database</code>:</p>
<p><a href='http://www.viale.com.mx/wp-content/uploads/2008/04/restore4.gif' title='restore4.gif'><img src='http://www.viale.com.mx/wp-content/uploads/2008/04/restore4.gif' alt='restore4.gif' /></a></p>
<p>Y listo, con eso se restaurarán todos los elementos de tu base de datos original.</p>
<p><b>Actualización</b>:<br />
Lo que he visto es que el usuario que tenías asignado a la base de datos se corrompe.  Simplemente crea otro usuario con un nombre distinto y vuelve a asignarle el ownership y los permisos a la base de datos, y listo.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.viale.mx/2008/04/11/como-restaurar-una-base-de-datos-de-sql-server-en-otro-servidor/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Cómo insertar un valor nulo (null) en SQL Server</title>
		<link>http://www.viale.mx/2008/02/24/como-insertar-un-valor-nulo-null-en-sql-server/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=como-insertar-un-valor-nulo-null-en-sql-server</link>
		<comments>http://www.viale.mx/2008/02/24/como-insertar-un-valor-nulo-null-en-sql-server/#comments</comments>
		<pubDate>Mon, 25 Feb 2008 00:48:47 +0000</pubDate>
		<dc:creator>Pablo Viale</dc:creator>
				<category><![CDATA[ASP.NET 2.0 / 3.5]]></category>
		<category><![CDATA[SQL Server]]></category>

		<guid isPermaLink="false">http://www.viale.com.mx/2008/02/24/como-insertar-un-valor-nulo-null-en-sql-server/</guid>
		<description><![CDATA[A veces es necesario insertar un valor nulo (null) en una base de datos de SQL Server usando ASP.NET. Esto puede ocurrir ya sea en un insert o un update. Suponiendo que el tipo de datos en la base de datos es un smallint y sabiendo que en ASP.NET corresponde a un tipo de datos [...]]]></description>
			<content:encoded><![CDATA[<p>A veces es necesario insertar un valor nulo (null) en una base de datos de SQL Server usando ASP.NET.</p>
<p>Esto puede ocurrir ya sea en un <code>insert</code> o un <code>update</code>.</p>
<p>Suponiendo que el tipo de datos en la base de datos es un <code>smallint</code> y sabiendo que en ASP.NET corresponde a un tipo de datos <code>Int16</code>, esta es la manera de declarar un entero nulo:</p>
<div class="igBar"><span id="lvbnet-25"><a href="#" onclick="javascript:showPlainTxt('vbnet-25'); return false;">Clic para mostrar texto plano</a></span></div>
<div class="syntax_hilite"><span class="langName">VB.NET:</span>
<div id="vbnet-25">
<div class="vbnet">
<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;"><span style="color: #0600FF;">Dim</span> EnteroNulo <span style="color: #FF8000;">As</span> Nullable<span style="color: #000000;">&#40;</span>Of Int16<span style="color: #000000;">&#41;</span> = <span style="color: #FF8000;">Nothing</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Y listo, ahora lo puedes usar en tu DAL o BLL:</p>
<div class="igBar"><span id="lvbnet-26"><a href="#" onclick="javascript:showPlainTxt('vbnet-26'); return false;">Clic para mostrar texto plano</a></span></div>
<div class="syntax_hilite"><span class="langName">VB.NET:</span>
<div id="vbnet-26">
<div class="vbnet">
<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;"><span style="color: #0600FF;">Dim</span> RenglonesAfectados <span style="color: #FF8000;">As</span> <span style="color: #FF0000;">Integer</span> = Adapter.<span style="color: #0000FF;">ModificaTabla</span><span style="color: #000000;">&#40;</span>Fecha, EnteroNulo<span style="color: #000000;">&#41;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
]]></content:encoded>
			<wfw:commentRss>http://www.viale.mx/2008/02/24/como-insertar-un-valor-nulo-null-en-sql-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cómo crear las tablas del Membership y Role Provider en SQL Server</title>
		<link>http://www.viale.mx/2008/02/22/como-crear-las-tablas-del-membership-y-role-provider-en-sql-server/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=como-crear-las-tablas-del-membership-y-role-provider-en-sql-server</link>
		<comments>http://www.viale.mx/2008/02/22/como-crear-las-tablas-del-membership-y-role-provider-en-sql-server/#comments</comments>
		<pubDate>Fri, 22 Feb 2008 19:51:32 +0000</pubDate>
		<dc:creator>Pablo Viale</dc:creator>
				<category><![CDATA[ASP.NET 2.0 / 3.5]]></category>
		<category><![CDATA[SQL Server]]></category>

		<guid isPermaLink="false">http://www.viale.com.mx/2008/02/22/como-crear-las-tablas-del-membership-y-role-provider-en-sql-server/</guid>
		<description><![CDATA[Si vas a implementar el Membership Provider de ASP.NET con SQL Server, seguramente encontrarás mucha información en Internet de cómo hacerlo. La parte que no todo mundo explica es cómo crear las tablas que contendrán toda la información de nombres de usuario, contraseñas, roles, etc. Las tablas se crean mediante la herramienta aspnet_regsql.exe que se [...]]]></description>
			<content:encoded><![CDATA[<p>Si vas a implementar el Membership Provider de ASP.NET con SQL Server, seguramente encontrarás mucha información en Internet de cómo hacerlo.  La parte que no todo mundo explica es cómo crear las tablas que contendrán toda la información de nombres de usuario, contraseñas, roles, etc.</p>
<p>Las tablas se crean mediante la herramienta <code>aspnet_regsql.exe</code> que se encuentra en el directorio de la versión del Framework que estés usando (ejemplo: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727).  Si usas la versión 3.5 tienes que usar la herramienta que viene en el fólder de la versión 2.</p>
<p>Abre una ventana de MS-DOS y cámbiate a dicho fólder:</p>
<p><a href='http://www.viale.com.mx/wp-content/uploads/2008/02/explorer.gif' title='aspnet_regsql.exe'><img src='http://www.viale.com.mx/wp-content/uploads/2008/02/explorer.gif' alt='aspnet_regsql.exe' /></a></p>
<p>La sintáxis de la herramienta es:</p>
<table cellspacing="0" cellpadding="5">
<tr>
<th>Option </th>
<th>Description </th>
</tr>
<tr>
<td>
<p><strong>-?</strong></p>
</td>
<td>
<p>Prints Aspnet_regsql.exe Help text in the command window.</p>
</td>
</tr>
<tr>
<td>
<p><strong>-W</strong></p>
</td>
<td>
<p>Runs the tool in wizard mode. This is the default if no command-line   arguments are specified.</p>
</td>
</tr>
<tr>
<td>
<p><strong>-C</strong> &lt;connection string&gt;</p>
</td>
<td>
<p>Specifies the connection string to the computer running SQL Server where the   database will be installed, or is already installed. This option is not   necessary if you specify only the server (<strong>-S</strong>) and login (<strong>-U</strong> and <strong>-P</strong>, or <strong>-E</strong>) information.</p>
</td>
</tr>
<tr>
<td>
<p><strong>-S</strong> &lt;server&gt;</p>
</td>
<td>
<p>Specifies the name of the computer running SQL Server where the database will   be installed, or is already installed.</p>
</td>
</tr>
<tr>
<td>
<p><strong>-U</strong> &lt;login ID&gt;</p>
</td>
<td>
<p>The SQL Server user ID to log in with. This option also requires the password   (<strong>-P</strong>) option. This option is not necessary if you are authenticating using   Windows credentials (<strong>-E</strong>).</p>
</td>
</tr>
<tr>
<td>
<p><strong>-P</strong> &lt;password&gt;</p>
</td>
<td>
<p>The SQL Server password to log in with. This option also requires the user ID   (<strong>-U</strong>) option. This option is not necessary if you are authenticating using   Windows credentials (<strong>-E</strong>).</p>
</td>
</tr>
<tr>
<td>
<p><strong>-E</strong></p>
</td>
<td>
<p>Authenticates using the Windows credentials of the currently logged-on   user.</p>
</td>
</tr>
<tr>
<td>
<p><strong>-sqlexportlonly</strong> &lt;filename&gt;</p>
</td>
<td>
<p>Generates a SQL script file that can be used to add or remove the specified   features. The specified actions are not performed.</p>
</td>
</tr>
</table>
<p>&nbsp;</p>
<table cellspacing="0" cellpadding="5">
<tr>
<th>Option </th>
<th>Description </th>
</tr>
<tr>
<td>
<p><strong>-A</strong> all|m|r|p|c|w</p>
</td>
<td>
<p>Adds support for one or more ASP.NET application services. Service   identifiers can be specified together or separately. The following identifiers   are used for ASP.NET application services:</p>
<p><strong>all</strong> - All services, including common tables and stored procedures   shared by the services</p>
<p><strong>m</strong> - Membership</p>
<p><strong>r</strong> - Role Manager</p>
<p><strong>p</strong> - Profile</p>
<p><strong>c</strong> - Web Parts Personalization</p>
<p><strong>w</strong> - Web Events</p>
</td>
</tr>
<tr>
<td>
<p><strong>-R</strong> all|m|r|p|c|w</p>
</td>
<td>
<p>Removes support for one or more application services. Service identifiers can   be specified together or separately. The following identifiers are used for   ASP.NET application services:</p>
<p><strong>all</strong> - All services, including common tables and stored procedures   shared by the services</p>
<p><strong>m</strong> - Membership</p>
<p><strong>r</strong> - Role Manager</p>
<p><strong>p</strong> - Profile</p>
<p><strong>c</strong> - Web Parts Personalization</p>
<p><strong>w</strong> - Web Events</p>
</td>
</tr>
<tr>
<td>
<p><strong>-Q</strong></p>
</td>
<td>
<p>Runs the tool in quiet mode and does not confirm before removing an   application service.</p>
</td>
</tr>
<tr>
<td>
<p><strong>-d</strong> &lt;database&gt;</p>
</td>
<td>
<p>Specifies the name of the database to create or modify for use with   application services. If the database is not specified, the default database   name of &quot;aspnetdb&quot; is used.</p>
</td>
</tr>
</table>
<p>&nbsp;</p>
<p>Si necesitas más información, <a href="http://msdn2.microsoft.com/en-us/library/ms229862(VS.80).aspx">visita esta página</a>.</p>
<p>En un caso sencillo, solamente necesitamos habilitar el <code>Membership provider</code> y el <code>Role provider</code>, por lo que nuestra sintáxis sería:</p>
<p><code>aspnet_regsql -S servidor\sqlexpress -U usuario -P contrasena -A mr -d nombredelabasededatos</code></p>
<p>Donde:</p>
<p>-S va seguido del nombre de tu servidor, ya sea en tu red local o en Internet (usa la IP)<br />
-U va seguido de tu nombre de usuario<br />
-P va seguido de tu contraseña<br />
-A va seguido de "mr" ya que queremos habilitar el <strong>M</strong>embership y <strong>R</strong>ole.<br />
-d va seguido del nombre de tu base de datos</p>
<p><a href='http://www.viale.com.mx/wp-content/uploads/2008/02/msdos.gif' title='Creando las tablas para el Membership y Role Providers'><img src='http://www.viale.com.mx/wp-content/uploads/2008/02/msdos.gif' alt='Creando las tablas para el Membership y Role Providers' /></a></p>
<p>Listo, ahora solamente verifica que se crearon las tablas correctamente:</p>
<p><a href='http://www.viale.com.mx/wp-content/uploads/2008/02/tablas.gif' title='Tablas de Membership y Role Provider'><img src='http://www.viale.com.mx/wp-content/uploads/2008/02/tablas.gif' alt='Tablas de Membership y Role Provider' /></a></p>
<h3>Actualización 2008-05-10</h3>
<p>Para entender cómo están relacionadas las tablas entre sí, puedes revisar el siguiente diagrama:</p>
<p><a href='http://www.viale.com.mx/wp-content/uploads/2008/05/diagrama.gif' title='Diagrama de tablas del Membership y Role Provider'><img src='http://www.viale.com.mx/wp-content/uploads/2008/05/diagrama.gif' alt='Diagrama de tablas del Membership y Role Provider' /></a></p>
<p>El siguiente paso sería crear el <code>connectionString</code> en tu archivo <code>web.config</code>, ponlo bajo la sección <code>configuration</code>:</p>
<div class="igBar"><span id="lxml-29"><a href="#" onclick="javascript:showPlainTxt('xml-29'); return false;">Clic para mostrar texto plano</a></span></div>
<div class="syntax_hilite"><span class="langName">XML:</span>
<div id="xml-29">
<div class="xml">
<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;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;connectionStrings<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;add</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">"MiConnectionString"</span> <span style="color: #000066;">connectionString</span>=<span style="color: #ff0000;">"Data Source=SERVIDOR\SQLEXPRESS;Initial Catalog=nombredelabasededatos;Persist Security Info=True;User ID=usuario;Password=contrasena"</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;">&nbsp; &nbsp; &nbsp;<span style="color: #000066;">providerName</span>=<span style="color: #ff0000;">"System.Data.SqlClient"</span> <span style="font-weight: bold; color: black;">/&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/connectionStrings<span style="font-weight: bold; color: black;">&gt;</span></span></span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Y luego, bajo la sección <code>system.web</code> coloca lo siguiente:</p>
<div class="igBar"><span id="lxml-30"><a href="#" onclick="javascript:showPlainTxt('xml-30'); return false;">Clic para mostrar texto plano</a></span></div>
<div class="syntax_hilite"><span class="langName">XML:</span>
<div id="xml-30">
<div class="xml">
<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;"><span style="color: #009900;"><span style="color: #808080; font-style: italic;">&lt;!--</span></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;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; The &lt;authentication&gt;</span></span> section enables configuration </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;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; of the security authentication mode used by </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ASP.NET to identify an incoming user. </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;">&nbsp; &nbsp; &nbsp; &nbsp; --&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;authentication</span> <span style="color: #000066;">mode</span>=<span style="color: #ff0000;">"Forms"</span><span style="font-weight: bold; color: black;">&gt;</span></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;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;forms</span> <span style="color: #000066;">loginUrl</span>=<span style="color: #ff0000;">"~/Default.aspx"</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">".ASPXFORMSAUTH"</span> <span style="color: #000066;">timeout</span>=<span style="color: #ff0000;">"300"</span><span style="font-weight: bold; color: black;">/&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/authentication<span style="font-weight: bold; color: black;">&gt;</span></span></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;">&nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;roleManager</span> <span style="color: #000066;">defaultProvider</span>=<span style="color: #ff0000;">"MiRoleProvider"</span> <span style="color: #000066;">enabled</span>=<span style="color: #ff0000;">"true"</span> <span style="color: #000066;">cacheRolesInCookie</span>=<span style="color: #ff0000;">"true"</span> <span style="color: #000066;">cookieName</span>=<span style="color: #ff0000;">".ASPROLES"</span> <span style="color: #000066;">cookieTimeout</span>=<span style="color: #ff0000;">"30"</span> <span style="color: #000066;">cookiePath</span>=<span style="color: #ff0000;">"/"</span> <span style="color: #000066;">cookieRequireSSL</span>=<span style="color: #ff0000;">"false"</span> <span style="color: #000066;">cookieSlidingExpiration</span>=<span style="color: #ff0000;">"true"</span> <span style="color: #000066;">cookieProtection</span>=<span style="color: #ff0000;">"All"</span><span style="font-weight: bold; color: black;">&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;providers<span style="font-weight: bold; color: black;">&gt;</span></span></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;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;clear</span><span style="font-weight: bold; color: black;">/&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;add</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">"MiRoleProvider"</span> <span style="color: #000066;">connectionStringName</span>=<span style="color: #ff0000;">"MiConnectionString"</span> <span style="color: #000066;">applicationName</span>=<span style="color: #ff0000;">"NOMBREAPP"</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"System.Web.Security.SqlRoleProvider"</span><span style="font-weight: bold; color: black;">/&gt;</span></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;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/providers<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/roleManager<span style="font-weight: bold; color: black;">&gt;</span></span></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;">&nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;membership</span> <span style="color: #000066;">defaultProvider</span>=<span style="color: #ff0000;">"MiMembershipProvider"</span><span style="font-weight: bold; color: black;">&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;providers<span style="font-weight: bold; color: black;">&gt;</span></span></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;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;clear</span><span style="font-weight: bold; color: black;">/&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;add</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">"MiMembershipProvider"</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"System.Web.Security.SqlMembershipProvider"</span> <span style="color: #000066;">connectionStringName</span>=<span style="color: #ff0000;">"MiConnectionString"</span> <span style="color: #000066;">applicationName</span>=<span style="color: #ff0000;">"NOMBREAPP"</span> <span style="color: #000066;">enablePasswordRetrieval</span>=<span style="color: #ff0000;">"false"</span> <span style="color: #000066;">enablePasswordReset</span>=<span style="color: #ff0000;">"true"</span> <span style="color: #000066;">requiresQuestionAndAnswer</span>=<span style="color: #ff0000;">"true"</span> <span style="color: #000066;">requiresUniqueEmail</span>=<span style="color: #ff0000;">"true"</span> <span style="color: #000066;">passwordFormat</span>=<span style="color: #ff0000;">"Clear"</span><span style="font-weight: bold; color: black;">/&gt;</span></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;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/providers<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/membership<span style="font-weight: bold; color: black;">&gt;</span></span></span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Con esto le indicas a tu aplicación que utilice para la autenticación la base de datos que creaste al inicio.</p>
<p>Ahora, para crear usuarios y roles utiliza la herramienta que viene incluida con Visual Web Developer 2008, haz clic en <code>Website -> ASP.NET Configuration</code>:</p>
<p><a href='http://www.viale.com.mx/wp-content/uploads/2008/05/aspnetconfiguration.gif' title='aspnetconfiguration.gif'><img src='http://www.viale.com.mx/wp-content/uploads/2008/05/aspnetconfiguration.gif' alt='aspnetconfiguration.gif' /></a></p>
<p>Esto abrirá una ventana de tu navegador y podrás ver la página administrativa en la que puedes crear roles, usuarios y asignar esos usuarios a los roles que desees.  Esta página administrativa, para conectarse a la base de datos, utiliza los valores establecidos en el <code>web.config</code>.</p>
<p><a href='http://www.viale.com.mx/wp-content/uploads/2008/05/herramienta.gif' title='herramienta.gif'><img src='http://www.viale.com.mx/wp-content/uploads/2008/05/herramienta.gif' alt='herramienta.gif' /></a></p>
<p>Ya no explico cómo usar esta herramienta porque es muy sencilla.</p>
<p>Si estás trabajando en un servidor local y creaste algunos roles y usuarios, y tienes que subir esa información al servidor con algún programa de sincronización de bases de datos, hazlo en este orden para evitar errores de integridad referencial:</p>
<p><strong>La siguiente tabla no debe ser sincronizada porque el procedimiento de aspnet_regsql rellena la información necesaria:</strong><br />
aspnet_SchemaVersions</p>
<p><strong>Primera pasada:</strong><br />
aspnet_Applications</p>
<p><strong>Segunda pasada:</strong><br />
aspnet_Users</p>
<p><strong>Tercera pasada:</strong><br />
aspnet_Membership</p>
<p><strong>Cuarta pasada:</strong><br />
aspnet_Roles</p>
<p><strong>Quinta pasada:</strong><br />
aspnet_UsersInRoles</p>
<p>Suerte!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.viale.mx/2008/02/22/como-crear-las-tablas-del-membership-y-role-provider-en-sql-server/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
	</channel>
</rss>

