<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>John DaCosta's SQL &#38; Technology Weblog</title>
	<atom:link href="http://dacosta9.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://dacosta9.wordpress.com</link>
	<description>Blog on Databases, Technology, Enterprise Reporting and Integration</description>
	<lastBuildDate>Mon, 19 Dec 2011 14:18:56 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='dacosta9.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>John DaCosta's SQL &#38; Technology Weblog</title>
		<link>http://dacosta9.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://dacosta9.wordpress.com/osd.xml" title="John DaCosta&#039;s SQL &#38; Technology Weblog" />
	<atom:link rel='hub' href='http://dacosta9.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Error: SSIS Error Code DTS_E_OLEDBERROR.  An OLE DB error has occurred. Error code: 0&#215;80004005</title>
		<link>http://dacosta9.wordpress.com/2011/11/10/error-ssis-error-code-dts_e_oledberror-an-ole-db-error-has-occurred-error-code-0x80004005/</link>
		<comments>http://dacosta9.wordpress.com/2011/11/10/error-ssis-error-code-dts_e_oledberror-an-ole-db-error-has-occurred-error-code-0x80004005/#comments</comments>
		<pubDate>Thu, 10 Nov 2011 15:49:01 +0000</pubDate>
		<dc:creator>john.dacosta</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[0x80004005]]></category>
		<category><![CDATA[OLE DB]]></category>
		<category><![CDATA[ssis]]></category>

		<guid isPermaLink="false">http://dacosta9.wordpress.com/?p=332</guid>
		<description><![CDATA[Check if the RetainSameConnection Option is set to true or false for your Database Connection. I was attempting to Update data by using a Data Flow Transformation OLE DB Source &#8211;&#62; OLE DB Command When the RetainSameConnection was set to TRUE, I encountered errors. When the RetainSameConnection was set to FALSE, the package functions as [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dacosta9.wordpress.com&amp;blog=5040766&amp;post=332&amp;subd=dacosta9&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Check if the RetainSameConnection Option is set to true or false for your Database Connection.<br />
I was attempting to Update data by using a Data Flow Transformation<br />
OLE DB Source &#8211;&gt; OLE DB Command</p>
<p>When the RetainSameConnection was set to TRUE, I encountered errors.<br />
When the RetainSameConnection was set to FALSE, the package functions as expected.<br />
Error: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0&#215;80004005.<br />
An OLE DB record is available. Source: &#8220;Microsoft SQL Server Native Client 10.0&#8243; Hresult: 0&#215;80004005 Description: &#8220;Syntax error, permission violation, or other nonspecific error&#8221;.</p>
<p><a href="http://connect.microsoft.com/SQLServer/feedback/details/682902/ssis-failing-pre-execution-when-retainsameconnection-is-set-to-true">http://connect.microsoft.com/SQLServer/feedback/details/682902/ssis-failing-pre-execution-when-retainsameconnection-is-set-to-true</a></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dacosta9.wordpress.com/332/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dacosta9.wordpress.com/332/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dacosta9.wordpress.com/332/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dacosta9.wordpress.com/332/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/dacosta9.wordpress.com/332/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/dacosta9.wordpress.com/332/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/dacosta9.wordpress.com/332/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/dacosta9.wordpress.com/332/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dacosta9.wordpress.com/332/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dacosta9.wordpress.com/332/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dacosta9.wordpress.com/332/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dacosta9.wordpress.com/332/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dacosta9.wordpress.com/332/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dacosta9.wordpress.com/332/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dacosta9.wordpress.com&amp;blog=5040766&amp;post=332&amp;subd=dacosta9&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://dacosta9.wordpress.com/2011/11/10/error-ssis-error-code-dts_e_oledberror-an-ole-db-error-has-occurred-error-code-0x80004005/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/ebd41674c1f6554393b8152a5cdae9c6?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">dacosta9</media:title>
		</media:content>
	</item>
		<item>
		<title>ERROR [IM014] [Microsoft][ODBC Driver Manager] The specified DSN contains an architecture mismatch between the Driver and Application</title>
		<link>http://dacosta9.wordpress.com/2011/10/27/error-im014-microsoftodbc-driver-manager-the-specified-dsn-contains-an-architecture-mismatch-between-the-driver-and-application/</link>
		<comments>http://dacosta9.wordpress.com/2011/10/27/error-im014-microsoftodbc-driver-manager-the-specified-dsn-contains-an-architecture-mismatch-between-the-driver-and-application/#comments</comments>
		<pubDate>Thu, 27 Oct 2011 17:28:43 +0000</pubDate>
		<dc:creator>john.dacosta</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[cache]]></category>
		<category><![CDATA[DSN]]></category>
		<category><![CDATA[intersystems]]></category>
		<category><![CDATA[mumps]]></category>
		<category><![CDATA[odbc]]></category>
		<category><![CDATA[ODBC DRIVER]]></category>
		<category><![CDATA[ODBCAD32.exe]]></category>
		<category><![CDATA[ssis]]></category>

		<guid isPermaLink="false">http://dacosta9.wordpress.com/?p=323</guid>
		<description><![CDATA[Did you create a DSN, but your application cannot access the DSN? I created a DSN, but could not connect via SSIS. It seems that the DSN I created was 32-bit, while the application I was using (SSIS) could only connect to 64-bit DSNs. After some research I have realized that there are two different [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dacosta9.wordpress.com&amp;blog=5040766&amp;post=323&amp;subd=dacosta9&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Did you create a DSN, but your application cannot access the DSN?</p>
<p>I created a DSN, but could not connect via SSIS. It seems that the DSN I created was 32-bit, while the application I was using (SSIS) could only connect to 64-bit DSNs.</p>
<p>After some research I have realized that there are two different ODBC Administrator runtimes on a 64-bit machine. The first ODBC Manager is used to manage 32-bit data sources, while the second is used to manage 64-bit data sources.</p>
<p>Use this ODBC Manager to Review 32 Bit Data Source Names</p>
<p><code>c:\windows\system32\odbcad32.exe</code></p>
<p>Use this ODBC Manager to Review 64 Bit Data Source Names</p>
<p><code>c:\windows\sysWOW64\odbcad32.exe<br />
</code><br />
If you are trying to access a DSN in your application and receive the error &#8220;ERROR [IM014] [Microsoft][ODBC Driver Manager] The specified DSN contains an architecture mismatch between the Driver and Application&#8221; check to see if you have a DSN configured for the architecture of your application ( 32-bit / 64-bit ).</p>
<p>I create my DSNs twice &#8211; once for 32 bit architecture and once for 64 bit architecture. My naming convention is as follows:</p>
<ul>
<li>DSN_NAME created using c:\windows\system32\odbcad32.exe</li>
<li>DSN_NAME_64 created using c:\windows\sysWOW64\odbcad32.exe</li>
</ul>
<div>Good Luck</div>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dacosta9.wordpress.com/323/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dacosta9.wordpress.com/323/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dacosta9.wordpress.com/323/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dacosta9.wordpress.com/323/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/dacosta9.wordpress.com/323/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/dacosta9.wordpress.com/323/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/dacosta9.wordpress.com/323/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/dacosta9.wordpress.com/323/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dacosta9.wordpress.com/323/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dacosta9.wordpress.com/323/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dacosta9.wordpress.com/323/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dacosta9.wordpress.com/323/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dacosta9.wordpress.com/323/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dacosta9.wordpress.com/323/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dacosta9.wordpress.com&amp;blog=5040766&amp;post=323&amp;subd=dacosta9&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://dacosta9.wordpress.com/2011/10/27/error-im014-microsoftodbc-driver-manager-the-specified-dsn-contains-an-architecture-mismatch-between-the-driver-and-application/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/ebd41674c1f6554393b8152a5cdae9c6?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">dacosta9</media:title>
		</media:content>
	</item>
		<item>
		<title>restore database and automatically drop database snapshot transact sql</title>
		<link>http://dacosta9.wordpress.com/2011/09/02/restore-database-and-automatically-drop-database-snapshot-transact-sql/</link>
		<comments>http://dacosta9.wordpress.com/2011/09/02/restore-database-and-automatically-drop-database-snapshot-transact-sql/#comments</comments>
		<pubDate>Fri, 02 Sep 2011 11:52:27 +0000</pubDate>
		<dc:creator>john.dacosta</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database administration]]></category>
		<category><![CDATA[database snapshot]]></category>
		<category><![CDATA[dba]]></category>
		<category><![CDATA[SQL SERVER]]></category>
		<category><![CDATA[sql server 2008]]></category>
		<category><![CDATA[sql server 2008 r2]]></category>
		<category><![CDATA[t-sql]]></category>
		<category><![CDATA[transact-sql]]></category>

		<guid isPermaLink="false">http://dacosta9.wordpress.com/?p=304</guid>
		<description><![CDATA[To facilitate quick testing of changes on my development and test environments I leverage database snapshots greatly.  The benefit of snapshots is that I can revert data to its previous state without having testers wait 30 &#8211; 40 minutes to perform another database restore, only to repeat tests again. Also, I can do a join [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dacosta9.wordpress.com&amp;blog=5040766&amp;post=304&amp;subd=dacosta9&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>To facilitate quick testing of changes on my development and test environments I leverage database snapshots greatly.  The benefit of snapshots is that I can revert data to its previous state without having testers wait 30 &#8211; 40 minutes to perform another database restore, only to repeat tests again. Also, I can do a join on the data in the snapshot database, to compare data.</p>
<p>Snapshots are a great help. However, I still need to refresh the source database every now and then from the production source to get up to date data. The following methodology allows me to drop all existing snapshots and restore database in one step, without having to do a lot of work manually checking for snapshots, then dropping each one individually, then performing my restore.</p>
<p>Once I have the script define for a database I put in svn so that my entire team has access to the script and can restore a database unattended.</p>
<p>e.g. http://svn/database/servername/database_restore_scripts/mydatabase.sql</p>
<p>Please note however that</p>
<ol>
<li>If you run this script you drop and lose all your snapshots on a database permanently.</li>
<li>If you do not have backups of your test databases, make sure that all your users are ok with you refreshing the environment before doing your data refresh from production.</li>
</ol>
<p>My process is to</p>
<ol>
<li>drop any existing database snapshots</li>
<li>offline the database</li>
<li>online the database</li>
<li>restore the database</li>
<li>fix users</li>
</ol>
<p><code><br />
-- DROP DATABASE SNAPSHOTS IF THEY EXIST<br />
DECLARE @emailMessage NVARCHAR(4000)<br />
DECLARE @database VARCHAR(100)<br />
DECLARE @sql NVARCHAR(4000)<br />
DECLARE cur_db CURSOR<br />
FOR<br />
select name<br />
from sys.databases<br />
where source_database_id IN (select database_id from sys.databases where name LIKE 'MyDatabase')<br />
ORDER BY create_date DESC<br />
FOR READ ONLY<br />
OPEN cur_db<br />
FETCH NEXT FROM cur_db INTO @database<br />
WHILE (@@FETCH_STATUS = 0 )<br />
BEGIN</p>
<p>SET @sql = 'ALTER DATABASE ['+@database+'] SET OFFLINE WITH ROLLBACK IMMEDIATE;'<br />
EXEC sp_executesql @sql<br />
SET @sql = 'ALTER DATABASE ['+@database+'] SET ONLINE;'<br />
EXEC sp_executesql @sql<br />
SET @sql = 'DROP DATABASE ['+@database+'];'<br />
-- PRINT @sql<br />
EXEC sp_executesql @sql<br />
FETCH NEXT FROM cur_db INTO @database<br />
END<br />
CLOSE cur_db<br />
DEALLOCATE cur_db<br />
GO<br />
-- OFFLINE THE MAIN DATABASE TO FORCE USERS OFF SYSTEM<br />
ALTER DATABASE  [MyDatabase] SET OFFLINE WITH ROLLBACK IMMEDIATE;<br />
GO<br />
-- ONLINE THE DATABASE<br />
ALTER DATABASE  [MyDatabase] SET ONLINE;<br />
GO</p>
<p>-- BEGIN RESTORING DATABASE.<br />
DECLARE @exitcode int, @sqlerrorcode int;<br />
EXEC MASTER..sqlbackup N'-SQL "RESTORE DATABASE [MyDatabase]<br />
FROM DISK=''\\BACKUP\MyDatabase.sqb''<br />
WITH REPLACE<br />
, DISCONNECT_EXISTING<br />
, RECOVERY"', @exitcode OUTPUT, @sqlerrorcode OUTPUT;<br />
IF (@exitcode &lt;&gt; 0) OR (@sqlerrorcode &lt;&gt; 0)<br />
BEGIN<br />
SET @emailMessage = 'FAILED DATABASE RESTORE | ' + @@SERVERNAME + ' | ' + SUSER_SNAME() + ' | '+ 'MyDatabase' + ' | ' + CONVERT(VARCHAR(20),getdate(),120)<br />
EXEC msdb.dbo.sp_send_dbmail<br />
@recipients='dbas@mydomain.com;',<br />
@subject= @emailMessage,<br />
@body= @emailMessage<br />
END<br />
ELSE<br />
BEGIN<br />
SET @emailMessage = 'SUCCESSFUL DATABASE RESTORE | ' + @@SERVERNAME + ' | ' + SUSER_SNAME() + ' | '+ 'MyDatabase' + ' | ' + CONVERT(VARCHAR(20),getdate(),120)<br />
EXEC msdb.dbo.sp_send_dbmail<br />
@recipients='dbas@mydomain.com;',<br />
@subject= @emailMessage,<br />
@body= @emailMessage<br />
END<br />
GO<br />
-- RUN CODE TO RESOLVE MISMATCHED SIDS and USER ACCOUNTS WITH LOGINS<br />
EXEC [MyDatabase].dbo.sp_fixusers<br />
GO</code></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dacosta9.wordpress.com/304/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dacosta9.wordpress.com/304/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dacosta9.wordpress.com/304/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dacosta9.wordpress.com/304/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/dacosta9.wordpress.com/304/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/dacosta9.wordpress.com/304/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/dacosta9.wordpress.com/304/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/dacosta9.wordpress.com/304/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dacosta9.wordpress.com/304/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dacosta9.wordpress.com/304/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dacosta9.wordpress.com/304/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dacosta9.wordpress.com/304/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dacosta9.wordpress.com/304/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dacosta9.wordpress.com/304/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dacosta9.wordpress.com&amp;blog=5040766&amp;post=304&amp;subd=dacosta9&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://dacosta9.wordpress.com/2011/09/02/restore-database-and-automatically-drop-database-snapshot-transact-sql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/ebd41674c1f6554393b8152a5cdae9c6?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">dacosta9</media:title>
		</media:content>
	</item>
		<item>
		<title>how to find stored procedures in sql server 2008 or sql server 2005 across all databases</title>
		<link>http://dacosta9.wordpress.com/2011/09/02/how-to-find-stored-procedures-in-sql-server-2008-or-sql-server-2005-across-all-databases/</link>
		<comments>http://dacosta9.wordpress.com/2011/09/02/how-to-find-stored-procedures-in-sql-server-2008-or-sql-server-2005-across-all-databases/#comments</comments>
		<pubDate>Fri, 02 Sep 2011 11:26:23 +0000</pubDate>
		<dc:creator>john.dacosta</dc:creator>
				<category><![CDATA[database]]></category>
		<category><![CDATA[database administration]]></category>
		<category><![CDATA[dba]]></category>
		<category><![CDATA[find stored procedure]]></category>
		<category><![CDATA[SQL SERVER]]></category>
		<category><![CDATA[t-sql]]></category>
		<category><![CDATA[transact-sql]]></category>

		<guid isPermaLink="false">http://dacosta9.wordpress.com/?p=299</guid>
		<description><![CDATA[As much as I hate searching for objects or not having complete information to troubleshoot an issue sometimes I have to go search for a stored procedure / function in a database server. To find which database contains a stored procedure I am looking for on a server I run the following script -- SEARCH [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dacosta9.wordpress.com&amp;blog=5040766&amp;post=299&amp;subd=dacosta9&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>As much as I hate searching for objects or not having complete information to troubleshoot an issue sometimes I have to go search for a stored procedure / function in a database server.</p>
<p>To find which database contains a stored procedure I am looking for on a server I run the following script</p>
<p><code>-- SEARCH FOR OBJECT<br />
-- FIND A ROUTINE / PROCEDURE / FUNCTION IN ALL DATABASES ON SERVER.<br />
EXEC sp_msforeachdb N'USE [?];<br />
SELECT<br />
@@SERVERNAME + '' | '' + SUSER_SNAME() + '' | ''+ DB_NAME() + '' | '' + CONVERT(VARCHAR(20),getdate(),120) as [SOURCE],<br />
ROUTINE_CATALOG, ROUTINE_SCHEMA, ROUTINE_NAME ,<br />
''[''+ CAST(@@SERVERNAME AS VARCHAR(100))+ ''].[''+ ROUTINE_CATALOG + ''].[''+ ROUTINE_SCHEMA + ''].[''+ ROUTINE_NAME + '']'' as [FQN]<br />
FROM [?].INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_NAME LIKE ''%myROUTINEName%'';<br />
'<br />
GO<br />
</code></p>
<p>I combine this with registering a group of servers in management studio, and in one quick step I can search for a procedure or function in any set of servers and databases.</p>
<p>&nbsp;</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dacosta9.wordpress.com/299/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dacosta9.wordpress.com/299/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dacosta9.wordpress.com/299/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dacosta9.wordpress.com/299/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/dacosta9.wordpress.com/299/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/dacosta9.wordpress.com/299/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/dacosta9.wordpress.com/299/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/dacosta9.wordpress.com/299/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dacosta9.wordpress.com/299/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dacosta9.wordpress.com/299/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dacosta9.wordpress.com/299/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dacosta9.wordpress.com/299/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dacosta9.wordpress.com/299/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dacosta9.wordpress.com/299/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dacosta9.wordpress.com&amp;blog=5040766&amp;post=299&amp;subd=dacosta9&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://dacosta9.wordpress.com/2011/09/02/how-to-find-stored-procedures-in-sql-server-2008-or-sql-server-2005-across-all-databases/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/ebd41674c1f6554393b8152a5cdae9c6?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">dacosta9</media:title>
		</media:content>
	</item>
		<item>
		<title>sql server create or replace procedure</title>
		<link>http://dacosta9.wordpress.com/2011/09/02/create-or-replace-procedure-in-sql-server-idempotent-change-management/</link>
		<comments>http://dacosta9.wordpress.com/2011/09/02/create-or-replace-procedure-in-sql-server-idempotent-change-management/#comments</comments>
		<pubDate>Fri, 02 Sep 2011 11:19:51 +0000</pubDate>
		<dc:creator>john.dacosta</dc:creator>
				<category><![CDATA[database]]></category>
		<category><![CDATA[sql]]></category>
		<category><![CDATA[change management]]></category>
		<category><![CDATA[redgate]]></category>
		<category><![CDATA[SQL SERVER]]></category>
		<category><![CDATA[sqlbackup]]></category>
		<category><![CDATA[t-sql]]></category>
		<category><![CDATA[transact-sql]]></category>
		<category><![CDATA[tsql]]></category>

		<guid isPermaLink="false">http://dacosta9.wordpress.com/?p=291</guid>
		<description><![CDATA[Oracle has great syntax to CREATE OR REPLACE a stored procedure. When I have to sync up multiple servers or deploy a specific procedure across my entire SQL Server Environment, I like to have a single script which can create the procedure where it needs to be created, and alter the procedure if it needs [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dacosta9.wordpress.com&amp;blog=5040766&amp;post=291&amp;subd=dacosta9&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Oracle has great syntax to CREATE OR REPLACE a stored procedure.</p>
<p>When I have to sync up multiple servers or deploy a specific procedure across my entire SQL Server Environment, I like to have a single script which can create the procedure where it needs to be created, and alter the procedure if it needs to be altered.</p>
<p>To make my code runnable on a server that may / may not already have my stored procedure I create a code stub, then replace it with the correct code.</p>
<p>Here is an example of code I use for database backups with Red Gate<br />
<code><br />
IF NOT EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_NAME LIKE 'usp_BackupLogs' AND ROUTINE_TYPE LIKE 'PROCEDURE' )<br />
BEGIN<br />
EXEC sp_executesql N'CREATE PROCEDURE [dbo].[usp_BackupLogs] AS SELECT CONVERT(VARCHAR(20),getdate() ,120)  + '' - Code Stub to Be Replaced by Alter Script '' as [Stub]'<br />
END<br />
GO<br />
ALTER PROCEDURE [dbo].[usp_BackupLogs]<br />
AS<br />
DECLARE @emailMessage NVARCHAR(4000)<br />
DECLARE @exitcode int<br />
DECLARE @sqlerrorcode int<br />
EXEC MASTER..sqlbackup N'-SQL "BACKUP LOGS [*] TO DISK = ''\\BACKUPS\LOGS\'' WITH NAME = '''', DESCRIPTION = '''', INIT, PASSWORD = ''mypassword'', MAXDATABLOCK = 65536,KEYSIZE = 256, COMPRESSION = 1, THREADS = 1"', @exitcode OUTPUT, @sqlerrorcode OUTPUT<br />
IF (@exitcode &lt;&gt;  0) OR (@sqlerrorcode &lt;&gt; 0)<br />
BEGIN<br />
SET @emailMessage = 'FAILED LOG BACKUP | ' + @@SERVERNAME + ' | ' + SUSER_SNAME() + ' | '+ DB_NAME() + ' | ' + CONVERT(VARCHAR(20),getdate(),120)<br />
EXEC msdb.dbo.sp_send_dbmail<br />
@recipients=N'DBAS@mydomain.com',<br />
@importance = 'High',<br />
@subject = @emailMessage,<br />
@body= @emailMessage<br />
END<br />
-- COMMENTED OUT INTENTIONALLY - DO NOT WANT EMAILS ON SUCCESSFUL LOG BACKUPS (esp. if scheduled every 15 minutes/ frequently)<br />
--ELSE<br />
-- BEGIN<br />
-- SET @emailMessage = 'SUCCESSFUL LOG BACKUP | ' + @@SERVERNAME + ' | ' + SUSER_SNAME() + ' | '+ DB_NAME() + ' | ' + CONVERT(VARCHAR(20),getdate(),120)<br />
-- EXEC msdb.dbo.sp_send_dbmail<br />
-- @recipients=N'DBAS@mydomain.com',<br />
-- @subject = @emailMessage,<br />
-- @body= @emailMessage ;<br />
-- End<br />
</code><br />
Following this example if I want to deploy all the code from a server to another machine, I generate the CREATE Statements using the following code:</p>
<p>This prevents the need for 2 separate scripts (CREATE AND ALTER).<br />
<code><br />
----------------------------------------------------------------<br />
-- CREATE OR REPLACE ALL STORED PROCEDURES<br />
----------------------------------------------------------------<br />
SELECT<br />
ROUTINE_NAME<br />
,'EXEC sp_executesql N'''+REPLACE(N'CREATE PROCEDURE ['+ROUTINE_SCHEMA+'].['+ROUTINE_NAME+'] AS SELECT CONVERT(VARCHAR(20),getdate() ,120) + '' - Code Stub to Be Replaced by Alter Script '' as [Stub]','''','''''') + '''' as cmd<br />
FROM INFORMATION_SCHEMA.ROUTINES<br />
WHERE<br />
ROUTINE_TYPE LIKE 'PROCEDURE'<br />
ORDER BY ROUTINE_NAME ASC<br />
</code><br />
Subsequently I script all objects as ALTERS and append to the CREATE script.</p>
<p>I create a single Script File with the following convention<br />
1. CREATE scripts (code stubs) ( with if not exists )<br />
2. ALTER scripts (real code)</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dacosta9.wordpress.com/291/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dacosta9.wordpress.com/291/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dacosta9.wordpress.com/291/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dacosta9.wordpress.com/291/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/dacosta9.wordpress.com/291/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/dacosta9.wordpress.com/291/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/dacosta9.wordpress.com/291/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/dacosta9.wordpress.com/291/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dacosta9.wordpress.com/291/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dacosta9.wordpress.com/291/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dacosta9.wordpress.com/291/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dacosta9.wordpress.com/291/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dacosta9.wordpress.com/291/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dacosta9.wordpress.com/291/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dacosta9.wordpress.com&amp;blog=5040766&amp;post=291&amp;subd=dacosta9&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://dacosta9.wordpress.com/2011/09/02/create-or-replace-procedure-in-sql-server-idempotent-change-management/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/ebd41674c1f6554393b8152a5cdae9c6?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">dacosta9</media:title>
		</media:content>
	</item>
		<item>
		<title>How to Find a Table on a SQL Server across all Databases</title>
		<link>http://dacosta9.wordpress.com/2011/08/24/how-to-find-a-table-on-a-sql-server-across-all-databases/</link>
		<comments>http://dacosta9.wordpress.com/2011/08/24/how-to-find-a-table-on-a-sql-server-across-all-databases/#comments</comments>
		<pubDate>Wed, 24 Aug 2011 22:25:41 +0000</pubDate>
		<dc:creator>john.dacosta</dc:creator>
				<category><![CDATA[database]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[database administration]]></category>
		<category><![CDATA[dba]]></category>
		<category><![CDATA[search]]></category>
		<category><![CDATA[sql]]></category>
		<category><![CDATA[SQL SERVER]]></category>

		<guid isPermaLink="false">http://dacosta9.wordpress.com/?p=282</guid>
		<description><![CDATA[As much as I hate searching for objects or not having complete information to troubleshoot an issue sometimes I have to go search for a table in the database. To find which database contains a table I am looking for on a server I run the following script -- SEARCH FOR OBJECT -- FIND A [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dacosta9.wordpress.com&amp;blog=5040766&amp;post=282&amp;subd=dacosta9&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>As much as I hate searching for objects or not having complete information to troubleshoot an issue sometimes I have to go search for a table in the database.</p>
<p>To find which database contains a table I am looking for on a server I run the following script</p>
<p><code>-- SEARCH FOR OBJECT<br />
-- FIND A TABLE IN ALL DATABASES ON SERVER.<br />
EXEC sp_msforeachdb N'USE [?];<br />
SELECT<br />
@@SERVERNAME + '' | '' + SUSER_SNAME() + '' | ''+ DB_NAME() + '' | '' + CONVERT(VARCHAR(20),getdate(),120) as [SOURCE],<br />
TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME ,<br />
''[''+ CAST(@@SERVERNAME AS VARCHAR(100))+ ''].[''+ TABLE_CATALOG + ''].[''+ TABLE_SCHEMA + ''].[''+ TABLE_NAME + '']'' as [FQN]<br />
FROM [?].INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME LIKE ''%mytableName%'';<br />
'<br />
GO</code></p>
<p>I combine this with registering a group of servers in management studio, and in one quick step I can search for a table in any set of servers and databases.</p>
<p>&nbsp;</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dacosta9.wordpress.com/282/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dacosta9.wordpress.com/282/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dacosta9.wordpress.com/282/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dacosta9.wordpress.com/282/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/dacosta9.wordpress.com/282/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/dacosta9.wordpress.com/282/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/dacosta9.wordpress.com/282/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/dacosta9.wordpress.com/282/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dacosta9.wordpress.com/282/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dacosta9.wordpress.com/282/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dacosta9.wordpress.com/282/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dacosta9.wordpress.com/282/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dacosta9.wordpress.com/282/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dacosta9.wordpress.com/282/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dacosta9.wordpress.com&amp;blog=5040766&amp;post=282&amp;subd=dacosta9&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://dacosta9.wordpress.com/2011/08/24/how-to-find-a-table-on-a-sql-server-across-all-databases/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/ebd41674c1f6554393b8152a5cdae9c6?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">dacosta9</media:title>
		</media:content>
	</item>
		<item>
		<title>SSIS Change Text File Column Delimiter in Text Editor</title>
		<link>http://dacosta9.wordpress.com/2011/06/16/ssis-change-text-file-column-delimiter-in-text-editor/</link>
		<comments>http://dacosta9.wordpress.com/2011/06/16/ssis-change-text-file-column-delimiter-in-text-editor/#comments</comments>
		<pubDate>Thu, 16 Jun 2011 20:55:20 +0000</pubDate>
		<dc:creator>john.dacosta</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[delimiters]]></category>
		<category><![CDATA[ssis]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://dacosta9.wordpress.com/?p=275</guid>
		<description><![CDATA[Ever want to change delimiter in SSIS Package without needing to open up BIDS? Quick Ctrl+H and change out _x0009_ Represents Tab Character _x007C_ Represents Vertical Bar Character _x002C_ Represents Comma Set Delimiter to TAB ( \t ) &#60;DTS:Property DTS:Name=&#8221;ColumnDelimiter&#8221; xml:space=&#8221;preserve&#8221;&#62;_x0009_&#60;/DTS:Property&#62; Set Delimiter to Vertical Bar ( &#124; ) &#60;DTS:Property DTS:Name=&#8221;ColumnDelimiter&#8221; xml:space=&#8221;preserve&#8221;&#62;_x007C_&#60;/DTS:Property&#62; Set Delimiter to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dacosta9.wordpress.com&amp;blog=5040766&amp;post=275&amp;subd=dacosta9&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Ever want to change delimiter in SSIS Package without needing to open up BIDS?</p>
<p>Quick Ctrl+H and change out</p>
<p>_x0009_ Represents Tab Character<br />
_x007C_ Represents Vertical Bar Character<br />
_x002C_ Represents Comma<br />
<strong>Set Delimiter to TAB ( \t )</strong><br />
&lt;DTS:Property DTS:Name=&#8221;ColumnDelimiter&#8221; xml:space=&#8221;preserve&#8221;&gt;_x0009_&lt;/DTS:Property&gt;<br />
<strong>Set Delimiter to Vertical Bar ( | )</strong><br />
&lt;DTS:Property DTS:Name=&#8221;ColumnDelimiter&#8221; xml:space=&#8221;preserve&#8221;&gt;_x007C_&lt;/DTS:Property&gt;<br />
<strong>Set Delimiter to Comma ( , )</strong><br />
&lt;DTS:Property DTS:Name=&#8221;ColumnDelimiter&#8221; xml:space=&#8221;preserve&#8221;&gt;_x002C_&lt;/DTS:Property&gt;</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dacosta9.wordpress.com/275/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dacosta9.wordpress.com/275/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dacosta9.wordpress.com/275/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dacosta9.wordpress.com/275/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/dacosta9.wordpress.com/275/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/dacosta9.wordpress.com/275/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/dacosta9.wordpress.com/275/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/dacosta9.wordpress.com/275/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dacosta9.wordpress.com/275/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dacosta9.wordpress.com/275/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dacosta9.wordpress.com/275/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dacosta9.wordpress.com/275/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dacosta9.wordpress.com/275/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dacosta9.wordpress.com/275/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dacosta9.wordpress.com&amp;blog=5040766&amp;post=275&amp;subd=dacosta9&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://dacosta9.wordpress.com/2011/06/16/ssis-change-text-file-column-delimiter-in-text-editor/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/ebd41674c1f6554393b8152a5cdae9c6?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">dacosta9</media:title>
		</media:content>
	</item>
		<item>
		<title>The file &#8216;myDatabase_LOG2&#8242; cannot be removed because it is not empty. Server: Msg 5042, Level 16, State 2, Line 1</title>
		<link>http://dacosta9.wordpress.com/2011/03/04/the-file-mydatabase_log2-cannot-be-removed-because-it-is-not-empty-server-msg-5042-level-16-state-2-line-1/</link>
		<comments>http://dacosta9.wordpress.com/2011/03/04/the-file-mydatabase_log2-cannot-be-removed-because-it-is-not-empty-server-msg-5042-level-16-state-2-line-1/#comments</comments>
		<pubDate>Fri, 04 Mar 2011 06:06:21 +0000</pubDate>
		<dc:creator>john.dacosta</dc:creator>
				<category><![CDATA[administration]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[database administration]]></category>
		<category><![CDATA[databases]]></category>
		<category><![CDATA[dba]]></category>
		<category><![CDATA[dbcc]]></category>
		<category><![CDATA[red gate]]></category>
		<category><![CDATA[shrinkfile]]></category>
		<category><![CDATA[SQL SERVER]]></category>
		<category><![CDATA[transaction log]]></category>

		<guid isPermaLink="false">http://dacosta9.wordpress.com/?p=276</guid>
		<description><![CDATA[When doing some re-indexing on a server, I had to create an additional log file so that the disk drive would not fill up and stop the database / re-index operation. Subsequent to doing my re-index, no matter how many times I attempted to do a dbcc shrinkfile with the emptyfile option, the file would [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dacosta9.wordpress.com&amp;blog=5040766&amp;post=276&amp;subd=dacosta9&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>When doing some re-indexing on a server, I had to create an additional log file so that the disk drive would not fill up and stop the database / re-index operation.</p>
<p>Subsequent to doing my re-index, no matter how many times I attempted to do a dbcc shrinkfile with the emptyfile option, the file would not delete.</p>
<p>The file &#8216;Database_Log_File&#8217; cannot be removed because it is not empty.</p>
<p><code><br />
USE [myDatabase]<br />
GO<br />
-- EMPTY TRANSACTION LOG FILE<br />
DBCC SHRINKFILE(myDatabase_LOG2,EMPTYFILE)<br />
GO<br />
-- TO CLEAR OUT TRANSACTION LOG FILE -- PERFORM A TRANSACTION LOG BACKUP - Standard SQL Backup</p>
<p>BACKUP LOG [myDatabase] TO DISK = '\\myBackupShare\myDatabase_yyyymmdd.trn',INIT, PASSWORD= 'myPasword';</p>
<p>-- TO CLEAR OUT TRANSACTION LOG FILE -- PERFORM A TRANSACTION LOG BACKUP - Red Gate<br />
DECLARE @exitcode int<br />
DECLARE @sqlerrorcode int<br />
EXEC MASTER..sqlbackup N'-SQL "BACKUP LOG [myDatabase]<br />
TO DISK = ''\\myBackupShare\''<br />
WITH NAME = '''', DESCRIPTION = '''',<br />
INIT, PASSWORD = ''myPasword''<br />
, MAXDATABLOCK = 65536,KEYSIZE = 256, COMPRESSION = 1, THREADS = 1"'<br />
, @exitcode OUTPUT, @sqlerrorcode OUTPUT<br />
GO</p>
<p>-- REMOVE TRANSACTION LOG FILE<br />
ALTER DATABASE [myDatabase]  REMOVE FILE [myDatabase_LOG2]<br />
GO<br />
</code></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dacosta9.wordpress.com/276/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dacosta9.wordpress.com/276/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dacosta9.wordpress.com/276/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dacosta9.wordpress.com/276/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/dacosta9.wordpress.com/276/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/dacosta9.wordpress.com/276/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/dacosta9.wordpress.com/276/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/dacosta9.wordpress.com/276/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dacosta9.wordpress.com/276/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dacosta9.wordpress.com/276/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dacosta9.wordpress.com/276/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dacosta9.wordpress.com/276/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dacosta9.wordpress.com/276/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dacosta9.wordpress.com/276/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dacosta9.wordpress.com&amp;blog=5040766&amp;post=276&amp;subd=dacosta9&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://dacosta9.wordpress.com/2011/03/04/the-file-mydatabase_log2-cannot-be-removed-because-it-is-not-empty-server-msg-5042-level-16-state-2-line-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/ebd41674c1f6554393b8152a5cdae9c6?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">dacosta9</media:title>
		</media:content>
	</item>
		<item>
		<title>Automatically Save Email Attachments following a naming convention</title>
		<link>http://dacosta9.wordpress.com/2011/03/04/automatically-save-email-attachments-following-a-naming-convention/</link>
		<comments>http://dacosta9.wordpress.com/2011/03/04/automatically-save-email-attachments-following-a-naming-convention/#comments</comments>
		<pubDate>Fri, 04 Mar 2011 05:49:48 +0000</pubDate>
		<dc:creator>john.dacosta</dc:creator>
				<category><![CDATA[business intelligence]]></category>
		<category><![CDATA[Automation]]></category>
		<category><![CDATA[Email]]></category>
		<category><![CDATA[Outlook]]></category>
		<category><![CDATA[VB]]></category>

		<guid isPermaLink="false">http://dacosta9.wordpress.com/?p=270</guid>
		<description><![CDATA[Have you ever have a client that will only send you data as Email attachments, no ftp, etc,&#8230; I had the same case, but did not have direct access to the exchange server and did not have the time to spend researching a sexier way to automatically download their attachments. This can easily be enhanced [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dacosta9.wordpress.com&amp;blog=5040766&amp;post=270&amp;subd=dacosta9&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Have you ever have a client that will only send you data as Email attachments, no ftp, etc,&#8230; I had the same case, but did not have direct access to the exchange server and did not have the time to spend researching a sexier way to automatically download their attachments.</p>
<p>This can easily be enhanced to do only messages from specific senders, other folders, etc. However the following code is what I used to perform one click save of all files to a network share, which then could be picked up by SSIS.</p>
<p><code><br />
    Sub SaveOutlookFileAttachments()<br />
    Dim oStores As Outlook.Stores<br />
    Dim oStore As Outlook.Store<br />
    Dim oFolders As Outlook.Folders<br />
    Dim oFolder As Outlook.Folder<br />
    Dim destFolder As String<br />
    Dim oItems As Outlook.Items<br />
    Dim oMsg As Outlook.MailItem<br />
    Dim oAttachments As Outlook.Attachments<br />
    Dim oAttachment As Outlook.Attachment<br />
    Dim oExplorer As Outlook.Explorer<br />
    destFolder = "\\NetworkShare\OrderDetailReport\"</p>
<p>    On Error Resume Next<br />
    Set oStores = Application.Session.Stores<br />
    For Each oStore In oStores<br />
        If oStore.DisplayName = "Inbox" Then<br />
            oFolders = oStore.GetSearchFolders<br />
            For Each oFolder In oFolders<br />
            oItems = oFolder.Items<br />
                For Each oMsg In oItems<br />
                    oAttachments = oMsg.Attachments<br />
                    For Each oAttachment In oAttachments<br />
                        If InStr(1, oAttachment.FileName, "_orderdetailreport_", vbTextCompare) Then<br />
                            'MsgBox ("This File Needs to be Saved: " &amp; oAttachment.FileName)<br />
                            oAttachment.SaveAsFile (destFolder &amp; oAtch.DisplayName)<br />
                        End If<br />
                    Next<br />
                Next<br />
            Next<br />
        End If<br />
    Next<br />
    End Sub<br />
</code></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dacosta9.wordpress.com/270/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dacosta9.wordpress.com/270/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dacosta9.wordpress.com/270/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dacosta9.wordpress.com/270/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/dacosta9.wordpress.com/270/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/dacosta9.wordpress.com/270/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/dacosta9.wordpress.com/270/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/dacosta9.wordpress.com/270/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dacosta9.wordpress.com/270/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dacosta9.wordpress.com/270/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dacosta9.wordpress.com/270/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dacosta9.wordpress.com/270/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dacosta9.wordpress.com/270/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dacosta9.wordpress.com/270/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dacosta9.wordpress.com&amp;blog=5040766&amp;post=270&amp;subd=dacosta9&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://dacosta9.wordpress.com/2011/03/04/automatically-save-email-attachments-following-a-naming-convention/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/ebd41674c1f6554393b8152a5cdae9c6?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">dacosta9</media:title>
		</media:content>
	</item>
		<item>
		<title>SSIS Error Code 0xC020209C &amp; SSIS Error Code DTS_E_PRIMEOUTPUTFAILED.</title>
		<link>http://dacosta9.wordpress.com/2010/08/11/ssis-error-code-0xc020209c-ssis-error-code-dts_e_primeoutputfailed/</link>
		<comments>http://dacosta9.wordpress.com/2010/08/11/ssis-error-code-0xc020209c-ssis-error-code-dts_e_primeoutputfailed/#comments</comments>
		<pubDate>Wed, 11 Aug 2010 02:57:18 +0000</pubDate>
		<dc:creator>john.dacosta</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://dacosta9.wordpress.com/?p=262</guid>
		<description><![CDATA[When the incorrect delimiter is provided in the input file to your SSIS Package you may encounter the following SSIS Error Code DTS_E_PRIMEOUTPUTFAILED. <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dacosta9.wordpress.com&amp;blog=5040766&amp;post=262&amp;subd=dacosta9&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I encountered the above error when attempting to load a data file which contained the pipe character &#8220;|&#8221; as the delimiter when the tab character &#8220;\t&#8221; was expected.</p>
<p>This error message occurred when the two following error codes were encountered together:</p>
<ul>
<li>Code: 0xC020209C<br />
Description: The column data for column &#8220;COLUMN NO 1&#8243; overflowed the disk I/O </li>
<li>Code: 0xC0047038<br />
Description: Error Code DTS_E_PRIMEOUTPUTFAILED.  The PrimeOutput method on component &#8220;Flat File Source&#8221; (1) returned error code 0xC0202091.  The component returned a failure code when the pipeline engine called PrimeOutput(). The meaning of the failure code is defined by the component, but the error is fatal and the pipeline stopped executing.  There may be error messages posted before this with more information about the failure.</li>
</ul>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
COLUMN DELIMITER WAS INCORRECT (“|”)<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
<code></p>
<p>Microsoft (R) SQL Server Execute Package Utility<br />
Version 10.0.2531.0 for 32-bit<br />
Copyright (C) Microsoft Corp 1984-2005. All rights reserved.</p>
<p>Started:  11:52:03 AM<br />
Error: 2010-08-10 11:52:33.21<br />
   Code: 0xC020209C<br />
   Source: Load Data Flat File Source [1]<br />
   Description: The column data for column "COLUMN NO 1" overflowed the disk I/O buffer.<br />
End Error<br />
Error: 2010-08-10 11:52:33.21<br />
   Code: 0xC0202091<br />
   Source: Load Data Flat File Source [1]<br />
   Description: An error occurred while skipping data rows.<br />
End Error<br />
Error: 2010-08-10 11:52:33.21<br />
   Code: 0xC0047038<br />
   Source: Load Data SSIS.Pipeline<br />
   Description: SSIS Error Code DTS_E_PRIMEOUTPUTFAILED.  The PrimeOutput method on component "Flat File Source" (1) returned error code 0xC0202091.  The component returned a failure code when the pipeline engine called PrimeOutput(). The meaning of the failure code is defined by the component, but the error is fatal and the pipeline stopped executing.  There may be error messages posted before this with more information about the failure.<br />
End Error<br />
DTExec: The package execution returned DTSER_FAILURE (1).<br />
Started:  11:52:03 AM<br />
Finished: 11:52:33 AM<br />
Elapsed:  30.109 seconds<br />
</code></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dacosta9.wordpress.com/262/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dacosta9.wordpress.com/262/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dacosta9.wordpress.com/262/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dacosta9.wordpress.com/262/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/dacosta9.wordpress.com/262/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/dacosta9.wordpress.com/262/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/dacosta9.wordpress.com/262/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/dacosta9.wordpress.com/262/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dacosta9.wordpress.com/262/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dacosta9.wordpress.com/262/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dacosta9.wordpress.com/262/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dacosta9.wordpress.com/262/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dacosta9.wordpress.com/262/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dacosta9.wordpress.com/262/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dacosta9.wordpress.com&amp;blog=5040766&amp;post=262&amp;subd=dacosta9&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://dacosta9.wordpress.com/2010/08/11/ssis-error-code-0xc020209c-ssis-error-code-dts_e_primeoutputfailed/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/ebd41674c1f6554393b8152a5cdae9c6?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">dacosta9</media:title>
		</media:content>
	</item>
	</channel>
</rss>
