<?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>..::\\ www.christiano.ch //::.. &#187; SQL Server</title>
	<atom:link href="http://www.christiano.ch/wordpress/category/microsoft/mssqlserver/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.christiano.ch/wordpress</link>
	<description>christiano.ch blog - personal knowledge base, news, memoires et cetera</description>
	<lastBuildDate>Fri, 06 Jan 2012 15:28:23 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<meta xmlns="http://www.w3.org/1999/xhtml" name="robots" content="noindex,follow" />
		<item>
		<title>SQL SERVER &#8211; Enable xp_cmdshell using sp_configure</title>
		<link>http://www.christiano.ch/wordpress/2010/10/17/sql-server-enable-xp_cmdshell-using-sp_configure/</link>
		<comments>http://www.christiano.ch/wordpress/2010/10/17/sql-server-enable-xp_cmdshell-using-sp_configure/#comments</comments>
		<pubDate>Sun, 17 Oct 2010 07:35:26 +0000</pubDate>
		<dc:creator>christian</dc:creator>
				<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[sp_configure]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[Stored Procedure]]></category>
		<category><![CDATA[xp_cmdshell]]></category>

		<guid isPermaLink="false">http://www.christiano.ch/wordpress/2010/10/17/sql-server-enable-xp_cmdshell-using-sp_configure/</guid>
		<description><![CDATA[They good old backdoor called xp_cmdshell is – and that’s absolutely ok – disabled by default starting Microsoft SQL Server 2000+. To re-enable that feature, there’s a stored procedure available called sp_configure. if you receive the following message, read on.. &#8230; <a href="http://www.christiano.ch/wordpress/2010/10/17/sql-server-enable-xp_cmdshell-using-sp_configure/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<table style="width: 675px" border="0" cellspacing="0" cellpadding="2">
<tbody>
<tr>
<td valign="top" width="666">They good old backdoor called xp_cmdshell is – and that’s absolutely ok – disabled by default starting Microsoft SQL Server 2000+. To re-enable that feature, there’s a stored procedure available called sp_configure.</td>
<td valign="top" width="10"><a href="http://www.christiano.ch/wordpress/wp-content/uploads/2010/10/Logo_Ms_SQL.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Logo_Ms_SQL" border="0" alt="Logo_Ms_SQL" src="http://www.christiano.ch/wordpress/wp-content/uploads/2010/10/Logo_Ms_SQL_thumb.png" width="165" height="103" /></a></td>
</tr>
</tbody>
</table>
<p> <span id="more-1134"></span>
</p>
<p>if you receive the following message, read on..</p>
<p><span style="color: #ff0000"><em>Msg 15281, Level 16, State 1, Procedure xp_cmdshell, Line 1</em>
<p>SQL Server blocked access to procedure &#8216;sys.xp_cmdshell&#8217; of component &#8216;xp_cmdshell&#8217; because this component is turned off as part of the security configuration for this server. A system administrator can enable the use of &#8216;xp_cmdshell&#8217; by using sp_configure. For more information about enabling &#8216;xp_cmdshell&#8217;, see &quot;Surface Area Configuration&quot; in SQL Server Books Online.</p>
<p>   </span></p>
<p>Start a SSMS (Microsoft SQL Server Management Studio), open a New Query Window and do the following:</p>
<p>Paste this and execute it using F5</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">EXEC</span> sp_configure <span style="color: #ff0000;">'show advanced options'</span><span style="color: #66cc66;">,</span> <span style="color: #cc66cc;">1</span>
  <span style="color: #993333; font-weight: bold;">GO</span> 
&nbsp;
RECONFIGURE
  <span style="color: #993333; font-weight: bold;">GO</span> 
&nbsp;
<span style="color: #993333; font-weight: bold;">EXEC</span> sp_configure <span style="color: #ff0000;">'xp_cmdshell'</span><span style="color: #66cc66;">,</span> <span style="color: #cc66cc;">0</span>
  <span style="color: #993333; font-weight: bold;">GO</span> 
&nbsp;
RECONFIGURE
  <span style="color: #993333; font-weight: bold;">GO</span></pre></div></div>

<p>to check if it&#8217;s configured properly, use this extended stored procedure:</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;">xp_cmdshell <span style="color: #ff0000;">'dir *.exe'</span></pre></div></div>

<div class="tweetthis" style="text-align:left;"><p> <a class="tt" href="http://twitter.com/intent/tweet?text=SQL+SERVER+%E2%80%93+Enable+xp_cmdshell+using+sp_configure+http%3A%2F%2Fchristiano.ch%2Fwordpress%2F%3Fp%3D1134" title="Post to Twitter"><img class="nothumb" src="http://www.christiano.ch/wordpress/wp-content/plugins/tweet-this/icons/en/twitter/tt-twitter.png" alt="Post to Twitter" /></a> <a class="tt" href="http://twitter.com/intent/tweet?text=SQL+SERVER+%E2%80%93+Enable+xp_cmdshell+using+sp_configure+http%3A%2F%2Fchristiano.ch%2Fwordpress%2F%3Fp%3D1134" title="Post to Twitter">Tweet This Post</a></p></div>]]></content:encoded>
			<wfw:commentRss>http://www.christiano.ch/wordpress/2010/10/17/sql-server-enable-xp_cmdshell-using-sp_configure/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SQL Server 2008: Error Saving changes is not permitted</title>
		<link>http://www.christiano.ch/wordpress/2009/11/28/sql-server-2008-error-saving-changes-is-not-permitted/</link>
		<comments>http://www.christiano.ch/wordpress/2009/11/28/sql-server-2008-error-saving-changes-is-not-permitted/#comments</comments>
		<pubDate>Sat, 28 Nov 2009 15:16:25 +0000</pubDate>
		<dc:creator>christian</dc:creator>
				<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[SQL Server]]></category>

		<guid isPermaLink="false">http://www.christiano.ch/wordpress/2009/11/28/sql-server-2008-error-saving-changes-is-not-permitted/</guid>
		<description><![CDATA[If you have been playing with SQL Server Management Studio 2008 and are modifying tables in the designer, you may run into this error: Save Saving changes is not permitted. The changes you have made require the following tables to &#8230; <a href="http://www.christiano.ch/wordpress/2009/11/28/sql-server-2008-error-saving-changes-is-not-permitted/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<table border="0" cellspacing="0" cellpadding="2" width="675">
<tbody>
<tr>
<td valign="top" width="625">If you have been playing with SQL Server Management Studio 2008 and are modifying tables in the designer, you may run into this error:         </p>
<p><strong>Save</strong>          <br />Saving changes is not permitted. The changes you have made require the following tables to be dropped and re-created.&#160; 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.</td>
<td valign="top" width="49"><a href="http://www.christiano.ch/wordpress/wp-content/uploads/2009/11/Logo_Ms_SQL5.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="Logo_Ms_SQL" border="0" alt="Logo_Ms_SQL" src="http://www.christiano.ch/wordpress/wp-content/uploads/2009/11/Logo_Ms_SQL_thumb5.png" width="150" height="94" /></a> </td>
</tr>
</tbody>
</table>
<p> <span id="more-796"></span>
<p>Here’s a screenshot: </p>
<p><a href="http://www.christiano.ch/wordpress/wp-content/uploads/2009/11/SQL_SavingChangesNotPermitted.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="SQL_SavingChangesNotPermitted" border="0" alt="SQL_SavingChangesNotPermitted" src="http://www.christiano.ch/wordpress/wp-content/uploads/2009/11/SQL_SavingChangesNotPermitted_thumb.png" width="455" height="365" /></a> </p>
<p>&#160;</p>
<p>In the 2008 , they have added a new option to prevent saving of changes that will require a table re-creation.&#160; If you think about it, this is a good thing.&#160; If you are running a production database, you want maximum performance.&#160; If Management Studio needs to re-create a table to apply a change that means it needs to create a copy of the table, transfer the data, create the new table, move the data over, delete the old stuff, etc.&#160; This can potentially be a major operation.&#160; </p>
<p>However, if you don’t want this feature enabled or our just working with a development or test database, it is easy to turn off.&#160; Just open up the Options window in Management Studio and go to “Designers –&gt; &quot;Table and Database Designers”, find the “Prevent saving changes that require table re-creation” option, and turn it off.</p>
<p>&#160;</p>
<p><a href="http://www.christiano.ch/wordpress/wp-content/uploads/2009/11/Micirosoft_SQL_2008_Prevent_saving_changed_that_require_table_recreation.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="Micirosoft_SQL_2008_Prevent_saving_changed_that_require_table_re-creation" border="0" alt="Micirosoft_SQL_2008_Prevent_saving_changed_that_require_table_re-creation" src="http://www.christiano.ch/wordpress/wp-content/uploads/2009/11/Micirosoft_SQL_2008_Prevent_saving_changed_that_require_table_recreation_thumb.png" width="640" height="367" /></a></p>
<div class="tweetthis" style="text-align:left;"><p> <a class="tt" href="http://twitter.com/intent/tweet?text=SQL+Server+2008%3A+Error+Saving+changes+is+not+permitted+http%3A%2F%2Fchristiano.ch%2Fwordpress%2F%3Fp%3D796" title="Post to Twitter"><img class="nothumb" src="http://www.christiano.ch/wordpress/wp-content/plugins/tweet-this/icons/en/twitter/tt-twitter.png" alt="Post to Twitter" /></a> <a class="tt" href="http://twitter.com/intent/tweet?text=SQL+Server+2008%3A+Error+Saving+changes+is+not+permitted+http%3A%2F%2Fchristiano.ch%2Fwordpress%2F%3Fp%3D796" title="Post to Twitter">Tweet This Post</a></p></div>]]></content:encoded>
			<wfw:commentRss>http://www.christiano.ch/wordpress/2009/11/28/sql-server-2008-error-saving-changes-is-not-permitted/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SQL: List Database Connections for specific user</title>
		<link>http://www.christiano.ch/wordpress/2009/11/12/sql-list-database-connections-for-specific-user/</link>
		<comments>http://www.christiano.ch/wordpress/2009/11/12/sql-list-database-connections-for-specific-user/#comments</comments>
		<pubDate>Thu, 12 Nov 2009 16:17:44 +0000</pubDate>
		<dc:creator>christian</dc:creator>
				<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[SQL Server]]></category>

		<guid isPermaLink="false">http://www.christiano.ch/wordpress/2009/11/12/sql-list-database-connections-for-specific-user/</guid>
		<description><![CDATA[Want to list all connections to a database for a specific user? go read on.. &#160; Code (SQL Statement) starts here select * from master..sysprocesses where loginame = &#8216;connexin.cim&#8217; &#8211;and hostname=&#8217;COMPUTERNAME&#8217; order by hostname Code (SQL Statement) ends here if &#8230; <a href="http://www.christiano.ch/wordpress/2009/11/12/sql-list-database-connections-for-specific-user/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<table border="0" cellspacing="0" cellpadding="2" width="675">
<tbody>
<tr>
<td valign="top" width="669">Want to list all connections to a database for a specific user? go read on.. </td>
<td valign="top" width="10"><a href="http://www.christiano.ch/wordpress/wp-content/uploads/2009/11/Logo_Ms_SQL3.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="Logo_Ms_SQL" border="0" alt="Logo_Ms_SQL" src="http://www.christiano.ch/wordpress/wp-content/uploads/2009/11/Logo_Ms_SQL_thumb3.png" width="150" height="94" /></a> </td>
</tr>
</tbody>
</table>
<p>&#160;</p>
<p> <span id="more-742"></span>
<p>Code (SQL Statement) starts here</p>
<p><font color="#0080ff" face="Courier New">select *     <br />from master..sysprocesses       <br />where loginame = &#8216;connexin.cim&#8217; &#8211;and hostname=&#8217;COMPUTERNAME&#8217;      <br />order by hostname</font></p>
<p>Code (SQL Statement) ends here</p>
<p>if you want to drop connections to a specific database, <a title="SQL Statement to drop database connections" href="http://www.christiano.ch/wordpress/2009/11/12/sql-drop-kill-database-connections/">check this post</a></p>
<p>No Management Studio installed? Just use osql.exe to connect to the database server.. <a title="Connect to Microsoft SQL Server using osql.exe" href="http://www.christiano.ch/wordpress/2009/08/26/sql-how-to-attach-a-database-db-using-osql-exe/">here’s an example ‘how to connect to Microsoft SQL using osql.exe’</a></p>
<div class="tweetthis" style="text-align:left;"><p> <a class="tt" href="http://twitter.com/intent/tweet?text=SQL%3A+List+Database+Connections+for+specific+user+http%3A%2F%2Fchristiano.ch%2Fwordpress%2F%3Fp%3D742" title="Post to Twitter"><img class="nothumb" src="http://www.christiano.ch/wordpress/wp-content/plugins/tweet-this/icons/en/twitter/tt-twitter.png" alt="Post to Twitter" /></a> <a class="tt" href="http://twitter.com/intent/tweet?text=SQL%3A+List+Database+Connections+for+specific+user+http%3A%2F%2Fchristiano.ch%2Fwordpress%2F%3Fp%3D742" title="Post to Twitter">Tweet This Post</a></p></div>]]></content:encoded>
			<wfw:commentRss>http://www.christiano.ch/wordpress/2009/11/12/sql-list-database-connections-for-specific-user/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SQL: Drop / Kill Database Connections</title>
		<link>http://www.christiano.ch/wordpress/2009/11/12/sql-drop-kill-database-connections/</link>
		<comments>http://www.christiano.ch/wordpress/2009/11/12/sql-drop-kill-database-connections/#comments</comments>
		<pubDate>Thu, 12 Nov 2009 15:59:59 +0000</pubDate>
		<dc:creator>christian</dc:creator>
				<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[SQL Server]]></category>

		<guid isPermaLink="false">http://www.christiano.ch/wordpress/2009/11/12/sql-drop-kill-database-connections/</guid>
		<description><![CDATA[If you need to drop database connections for a specific database, go read on.. This has been tested for Microsoft SQL Server 2005 and Microsoft SQL Server 2008. Code starts here use master declare @vcdbname varchar(50) /* @vcdbname =&#62; set &#8230; <a href="http://www.christiano.ch/wordpress/2009/11/12/sql-drop-kill-database-connections/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<table border="0" cellspacing="0" cellpadding="2" width="675">
<tbody>
<tr>
<td valign="top" width="554">If you need to drop database connections for a specific database, go read on..          <br />This has been tested for Microsoft SQL Server 2005 and Microsoft SQL Server 2008.</td>
<td valign="top" width="120"><a href="http://www.christiano.ch/wordpress/wp-content/uploads/2009/11/Logo_Ms_SQL4.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="Logo_Ms_SQL" border="0" alt="Logo_Ms_SQL" src="http://www.christiano.ch/wordpress/wp-content/uploads/2009/11/Logo_Ms_SQL_thumb4.png" width="150" height="94" /></a> </td>
</tr>
</tbody>
</table>
<p> <span id="more-739"></span>
<p>Code starts here</p>
<p><font color="#0080ff" face="Courier New">use master      <br />declare @vcdbname varchar(50)       <br /><strong><font color="#ff0000">/* @vcdbname =&gt; set it to the database you want the connections to be dropped.. */</font></strong>       <br />Set @vcdbname = &#8216;cxnIM&#8217; </font></p>
<p><font color="#0080ff" face="Courier New">set nocount on      <br />declare Users cursor for       <br />select spid       <br />from master..sysprocesses       <br />where db_name(dbid) = @vcdbname       <br />declare @spid int, @str varchar(255)       <br />open users       <br />fetch next from users into @spid       <br />while @@fetch_status &lt;&gt; -1       <br />begin       <br />&#160;&#160; if @@fetch_status = 0       <br />&#160;&#160; begin       <br />&#160;&#160; print @spid       <br />&#160;&#160;&#160;&#160;&#160; set @str = &#8216;kill &#8216; + convert(varchar, @spid)       <br />&#160;&#160;&#160;&#160;&#160; exec (@str)       <br />&#160;&#160; end       <br />&#160;&#160; fetch next from users into @spid       <br />end       <br />deallocate users</font></p>
</p>
<p>and ends here</p>
<div class="tweetthis" style="text-align:left;"><p> <a class="tt" href="http://twitter.com/intent/tweet?text=SQL%3A+Drop+%2F+Kill+Database+Connections+http%3A%2F%2Fchristiano.ch%2Fwordpress%2F%3Fp%3D739" title="Post to Twitter"><img class="nothumb" src="http://www.christiano.ch/wordpress/wp-content/plugins/tweet-this/icons/en/twitter/tt-twitter.png" alt="Post to Twitter" /></a> <a class="tt" href="http://twitter.com/intent/tweet?text=SQL%3A+Drop+%2F+Kill+Database+Connections+http%3A%2F%2Fchristiano.ch%2Fwordpress%2F%3Fp%3D739" title="Post to Twitter">Tweet This Post</a></p></div>]]></content:encoded>
			<wfw:commentRss>http://www.christiano.ch/wordpress/2009/11/12/sql-drop-kill-database-connections/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>SQL how to attach a database / DB using osql.exe</title>
		<link>http://www.christiano.ch/wordpress/2009/08/26/sql-how-to-attach-a-database-db-using-osql-exe/</link>
		<comments>http://www.christiano.ch/wordpress/2009/08/26/sql-how-to-attach-a-database-db-using-osql-exe/#comments</comments>
		<pubDate>Wed, 26 Aug 2009 16:29:19 +0000</pubDate>
		<dc:creator>christian</dc:creator>
				<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[SQL Server]]></category>

		<guid isPermaLink="false">http://www.christiano.ch/wordpress/?p=471</guid>
		<description><![CDATA[This is a quite simple task .. Assuming you have an MDF file called cxnMassImport.mdf and you want to attach it using osql.exe. Open a CMD Type: osql.exe -E -S .\SQLExpress If you don&#8217;t have osql.exe on the system, you &#8230; <a href="http://www.christiano.ch/wordpress/2009/08/26/sql-how-to-attach-a-database-db-using-osql-exe/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>This is a quite simple task ..</p>
<p>Assuming you have an MDF file called cxnMassImport.mdf and you want to attach it using osql.exe.</p>
<p>Open a CMD</p>
<p>Type:</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;">osql<span style="color: #66cc66;">.</span>exe <span style="color: #66cc66;">-</span>E <span style="color: #66cc66;">-</span>S <span style="color: #66cc66;">.</span>\SQLExpress</pre></div></div>

<p><span id="more-471"></span>If you don&#8217;t have osql.exe on the system, you can just copy it from an SQL Server to your system. Osql.exe can (usually) be found under<br />
<em><strong>%ProgramFiles%\Microsoft SQL Server\90\Tools\Binn\OSQL.EXE</strong></em> (for a SQL 2005 Installation)<br />
<em><strong>%ProgramFiles%\Microsoft SQL Server\100\Tools\Binn\OSQL.EXE</strong></em> (for a SQL 2008 Installation)<br />
All of the osql.exe&#8217;s dependencies (DLLs etc) exist on a more or less default Windows setup.</p>
<p><strong>The used osql.exe syntax for this example is:</strong><br />
-E =&gt; Trusted Connection &#8211; means your currently logged on user credentials are used to do the connection to the SQL Server</p>
<p>-S =&gt; Servername and Instance. Use a dot for the local system. If your SQL Server is some kind of MSDE or SQL Express Version, you must provide the Instance Name. For SQL Express it is usually SQLExpress. To find out the Instance Name, go to Services.msc and check the SQL Server Service. See the value between the ().</p>
<div id="attachment_488" class="wp-caption alignnone" style="width: 608px"><img class="size-full wp-image-488" title="Services_SQLServer(Instance)" src="http://www.christiano.ch/wordpress/wp-content/uploads/2009/08/Services_SQLServerInstance1.PNG" alt="Services_SQLServer(Instance)" width="598" height="20" /><p class="wp-caption-text">Services_SQLServer(Instance)</p></div>
<p>To connect to the SQL Server Instance using <em>SQL integrated security</em>, use the -<strong><em>U for the username</em></strong> (sa) and <em><strong>-P for the password</strong></em>.<br />
i.e.</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;">osql<span style="color: #66cc66;">.</span>exe <span style="color: #66cc66;">-</span>U sa <span style="color: #66cc66;">-</span>P P@ssW0Rd <span style="color: #66cc66;">-</span>S <span style="color: #66cc66;">.</span>\SQLExpress</pre></div></div>

<p><strong>Now to attach the MDF file, on the osql.exe prompt write:</strong></p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;">sp_attach_db @dbname<span style="color: #66cc66;">=</span><span style="color: #ff0000;">'cxnMassImport'</span><span style="color: #66cc66;">,</span> @filename1<span style="color: #66cc66;">=</span><span style="color: #ff0000;">'C:<span style="color: #000099; font-weight: bold;">\P</span>rogram Files<span style="color: #000099; font-weight: bold;">\M</span>icrosoft SQL Server<span style="color: #000099; font-weight: bold;">\M</span>SSQL.1<span style="color: #000099; font-weight: bold;">\M</span>SSQL<span style="color: #000099; font-weight: bold;">\D</span>ata<span style="color: #000099; font-weight: bold;">\c</span>xnMassImport.mdf'</span>
<span style="color: #993333; font-weight: bold;">GO</span></pre></div></div>

<div id="attachment_483" class="wp-caption alignnone" style="width: 675px"><img class="size-full wp-image-483" title="osql_sp_attach_db" src="http://www.christiano.ch/wordpress/wp-content/uploads/2009/08/osql_sp_attach_db.png" alt="osql_sp_attach_db" width="665" height="86" /><p class="wp-caption-text">osql_sp_attach_db</p></div>
<p><strong>To verify if the database has been attached write:</strong></p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">SELECT</span> name<span style="color: #66cc66;">,</span> filename <span style="color: #993333; font-weight: bold;">FROM</span> sysdatabases <span style="color: #993333; font-weight: bold;">WHERE</span> name <span style="color: #993333; font-weight: bold;">LIKE</span> <span style="color: #ff0000;">'%cxn%'</span></pre></div></div>

<dl id="attachment_484" class="wp-caption alignnone" style="width: 649px;">
<dt class="wp-caption-dt"><img class="size-full wp-image-484" title="Osql_SELECT_Name_Filename_FROM_SysDatabases" src="http://www.christiano.ch/wordpress/wp-content/uploads/2009/08/Osql_SELECT_Name_Filename_FROM_SysDatabases.PNG" alt="Osql_SELECT_Name_Filename_FROM_SysDatabases" width="639" height="423" /></dt>
<dd class="wp-caption-dd">Osql_SELECT_Name_Filename_FROM_SysDatabases</dd>
</dl>
<p><strong>If you need to detach the database, write:</strong></p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;">sp_detach_db @dbname<span style="color: #66cc66;">=</span><span style="color: #ff0000;">'cxnMassImport'</span></pre></div></div>

<div class="tweetthis" style="text-align:left;"><p> <a class="tt" href="http://twitter.com/intent/tweet?text=SQL+how+to+attach+a+database+%2F+DB+using+osql.exe+http%3A%2F%2Fchristiano.ch%2Fwordpress%2F%3Fp%3D471" title="Post to Twitter"><img class="nothumb" src="http://www.christiano.ch/wordpress/wp-content/plugins/tweet-this/icons/en/twitter/tt-twitter.png" alt="Post to Twitter" /></a> <a class="tt" href="http://twitter.com/intent/tweet?text=SQL+how+to+attach+a+database+%2F+DB+using+osql.exe+http%3A%2F%2Fchristiano.ch%2Fwordpress%2F%3Fp%3D471" title="Post to Twitter">Tweet This Post</a></p></div>]]></content:encoded>
			<wfw:commentRss>http://www.christiano.ch/wordpress/2009/08/26/sql-how-to-attach-a-database-db-using-osql-exe/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>How to: Change the Default Login Authentication Mode to SQL</title>
		<link>http://www.christiano.ch/wordpress/2009/07/25/how-to-change-the-default-login-authentication-mode-to-sql/</link>
		<comments>http://www.christiano.ch/wordpress/2009/07/25/how-to-change-the-default-login-authentication-mode-to-sql/#comments</comments>
		<pubDate>Sat, 25 Jul 2009 12:38:18 +0000</pubDate>
		<dc:creator>christian</dc:creator>
				<category><![CDATA[SQL Server]]></category>

		<guid isPermaLink="false">http://blog.christiano.ch/?p=28</guid>
		<description><![CDATA[How to Change the Default Login Authentication Mode to SQL short description: use SECURITYMODE=SQL as command line setup parameter when installing SQL Server or change one of the following registry keys: Default instance: HKLM\Software\Microsoft\MSSqlserver\MSSqlServer\LoginMode Named instance: HKLM\Software\Microsoft\Microsoft SQL Server\ Instance &#8230; <a href="http://www.christiano.ch/wordpress/2009/07/25/how-to-change-the-default-login-authentication-mode-to-sql/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>How to Change the Default Login Authentication Mode to SQL</p>
<p>short description:<br />
use SECURITYMODE=SQL as command line setup parameter when installing SQL Server<br />
or<br />
change one of the following registry keys:</p>
<p><em>Default instance:</em><br />
<strong>HKLM\Software\Microsoft\MSSqlserver\MSSqlServer\LoginMode</strong></p>
<p><em>Named instance:</em><br />
<strong>HKLM\Software\Microsoft\Microsoft SQL Server\ Instance Name\MSSQLServer\LoginMode</strong></p>
<p>to <strong>2 for mixed-mode</strong> or <strong>1 for integrated security</strong>. (Integrated is the default setup for the SQL Server 2000 Data Engine.)</p>
<p>for more refer to article MS Q285097</p>
<div class="tweetthis" style="text-align:left;"><p> <a class="tt" href="http://twitter.com/intent/tweet?text=How+to%3A+Change+the+Default+Login+Authentication+Mode+to+SQL+http%3A%2F%2Fchristiano.ch%2Fwordpress%2F%3Fp%3D28" title="Post to Twitter"><img class="nothumb" src="http://www.christiano.ch/wordpress/wp-content/plugins/tweet-this/icons/en/twitter/tt-twitter.png" alt="Post to Twitter" /></a> <a class="tt" href="http://twitter.com/intent/tweet?text=How+to%3A+Change+the+Default+Login+Authentication+Mode+to+SQL+http%3A%2F%2Fchristiano.ch%2Fwordpress%2F%3Fp%3D28" title="Post to Twitter">Tweet This Post</a></p></div>]]></content:encoded>
			<wfw:commentRss>http://www.christiano.ch/wordpress/2009/07/25/how-to-change-the-default-login-authentication-mode-to-sql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Solution: SQL Server Enterprise Manager General OLE Error 16386</title>
		<link>http://www.christiano.ch/wordpress/2009/07/25/solution-sql-server-enterprise-manager-general-ole-error-16386/</link>
		<comments>http://www.christiano.ch/wordpress/2009/07/25/solution-sql-server-enterprise-manager-general-ole-error-16386/#comments</comments>
		<pubDate>Sat, 25 Jul 2009 12:36:02 +0000</pubDate>
		<dc:creator>christian</dc:creator>
				<category><![CDATA[SQL Server]]></category>

		<guid isPermaLink="false">http://blog.christiano.ch/?p=26</guid>
		<description><![CDATA[Tried to start Microsoft SQL Server Enterprise Manager and got stuck at the error message General OLE Error 16386: try this, maybe this solves the issue.. a. Stop all SQL Server services (MSSQLServer, SQLServerAgent, MSSEARCH) b. Open command prompt and &#8230; <a href="http://www.christiano.ch/wordpress/2009/07/25/solution-sql-server-enterprise-manager-general-ole-error-16386/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Tried to start Microsoft SQL Server Enterprise Manager and got stuck at the error message <strong>General OLE Error 16386</strong>:</p>
<p>try this, maybe this solves the issue..</p>
<p>a. Stop all SQL Server services (MSSQLServer, SQLServerAgent, MSSEARCH)<br />
b. Open command prompt and go to the %ProgramFiles%\Microsoft SQL Server\80\Tools\Binn directory<br />
c. Unregister the following .dll files (Ex. regsvr32 /u dtsui.dll): dtsui.dll,sqlns.dll, sqldmo.dll, sqllex.dll, sqlmmc.dll<br />
d. Copy and paste the .dll files from a CD (under x86\Binn directory) to the Program Files\Microsoft SQL Server\80\Tools\Binn<br />
e. Register the .dll files (Ex. regsvr32 sqldmo.dll)</p>
<div class="tweetthis" style="text-align:left;"><p> <a class="tt" href="http://twitter.com/intent/tweet?text=Solution%3A+SQL+Server+Enterprise+Manager+General+OLE+Error+16386+http%3A%2F%2Fchristiano.ch%2Fwordpress%2F%3Fp%3D26" title="Post to Twitter"><img class="nothumb" src="http://www.christiano.ch/wordpress/wp-content/plugins/tweet-this/icons/en/twitter/tt-twitter.png" alt="Post to Twitter" /></a> <a class="tt" href="http://twitter.com/intent/tweet?text=Solution%3A+SQL+Server+Enterprise+Manager+General+OLE+Error+16386+http%3A%2F%2Fchristiano.ch%2Fwordpress%2F%3Fp%3D26" title="Post to Twitter">Tweet This Post</a></p></div>]]></content:encoded>
			<wfw:commentRss>http://www.christiano.ch/wordpress/2009/07/25/solution-sql-server-enterprise-manager-general-ole-error-16386/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

