<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>SQL2005 &amp; C# 3.0</title>
	
	<link>http://www.cbtr.net</link>
	<description />
	<pubDate>Thu, 24 Sep 2009 02:19:11 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/cbtr" type="application/rss+xml" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com" /><item>
		<title>Return a status or value from sp_start_job</title>
		<link>http://feedproxy.google.com/~r/cbtr/~3/s81xYw2oUl8/</link>
		<comments>http://www.cbtr.net/2009/04/30/return-a-status-or-value-from-sp_start_job/#comments</comments>
		<pubDate>Fri, 01 May 2009 02:55:10 +0000</pubDate>
		<dc:creator>Obe</dc:creator>
		
		<category><![CDATA[sql]]></category>

		<category><![CDATA[How to get job result from sp_start_job]]></category>

		<category><![CDATA[returning value from sp_start_job]]></category>

		<category><![CDATA[Sp_start_job]]></category>

		<guid isPermaLink="false">http://www.cbtr.net/?p=368</guid>
		<description><![CDATA[In my procedure, I&#8217;m calling a job on a remote server and if this call fails, I would like the code to handle it accordingly.  So if I get a return value or status of 0, the job started successfully.  If 1, then it failed to start.
Now I can&#8217;t monitor the entire duration [...]]]></description>
			<content:encoded><![CDATA[<p>In my procedure, I&#8217;m calling a job on a remote server and if this call fails, I would like the code to handle it accordingly.  So if I get a return value or status of 0, the job started successfully.  If 1, then it failed to start.</p>
<p>Now I can&#8217;t monitor the entire duration of the SQL job on the remote server, I&#8217;ll need another process for it.</p>
<p>The code to return a value or status from sp_start_job is as follow:</p>
<p><font color="green"><br />
declare @rnt int</p>
<p>exec @rnt = msdb.dbo.sp_start_job @job_name = &#8216;JOB_NAME&#8217;</p>
<p>if @rnt = 1<br />
begin<br />
&#8212; code to handle the failure<br />
end<br />
</font></p>
]]></content:encoded>
			<wfw:commentRss>http://www.cbtr.net/2009/04/30/return-a-status-or-value-from-sp_start_job/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.cbtr.net/2009/04/30/return-a-status-or-value-from-sp_start_job/</feedburner:origLink></item>
		<item>
		<title>iPhone 3G</title>
		<link>http://feedproxy.google.com/~r/cbtr/~3/WeWphdlQUJU/</link>
		<comments>http://www.cbtr.net/2009/04/22/iphone-3g/#comments</comments>
		<pubDate>Wed, 22 Apr 2009 23:47:51 +0000</pubDate>
		<dc:creator>Obe</dc:creator>
		
		<category><![CDATA[general]]></category>

		<guid isPermaLink="false">http://www.cbtr.net/?p=352</guid>
		<description><![CDATA[The last time I touched an Apple, Inc. device was WAY WAY WAY back in the 3rd grade.  Since high school, it has been nothing but PC and Microsoft Windows stuff.
Last weekend, I finally went out to purchase the Apple iPhone 3G.  I wanted one since its release but at $600 a pop, [...]]]></description>
			<content:encoded><![CDATA[<p>The last time I touched an Apple, Inc. device was WAY WAY WAY back in the 3rd grade.  Since high school, it has been nothing but PC and Microsoft Windows stuff.</p>
<p>Last weekend, I finally went out to purchase the Apple iPhone 3G.  I wanted one since its release but at $600 a pop, I didn&#8217;t want to shell it out.  When I learned about unlocking and jailbreaking, I was in.</p>
<p>So far, I&#8217;m loving the iPhone.  I&#8217;ve always been a fan of BlackBerry or people in my profession call it a &#8216;CrackBerry&#8217; because you never go anywhere with out it.  I really wanted to the BlackBerry Storm but only Verizon carries it and I don&#8217;t like Verizon.  I just recently found out that you can unlock that too but its cool, my iPhone is rocking.</p>
<p>Got over 25 apps and the best one thus far is the video recorder, which basically turn the iPhone digital camera into a digital camcorder.</p>
<p>http://www.quickpwn &#8211;> for jailbreaking.  Then use yellowsn0w to unlock.  Afterward, install Cydia.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cbtr.net/2009/04/22/iphone-3g/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.cbtr.net/2009/04/22/iphone-3g/</feedburner:origLink></item>
		<item>
		<title>Creating Windows Clustered Resources</title>
		<link>http://feedproxy.google.com/~r/cbtr/~3/qhTSCRroYoU/</link>
		<comments>http://www.cbtr.net/2009/04/14/creating-windows-clustered-resources/#comments</comments>
		<pubDate>Wed, 15 Apr 2009 04:11:57 +0000</pubDate>
		<dc:creator>Obe</dc:creator>
		
		<category><![CDATA[sql]]></category>

		<category><![CDATA[automate creating clustered resources]]></category>

		<category><![CDATA[clustered resources]]></category>

		<category><![CDATA[Creating Windows Clustered Resources]]></category>

		<category><![CDATA[windows 2003 clustered resources]]></category>

		<guid isPermaLink="false">http://www.cbtr.net/?p=337</guid>
		<description><![CDATA[Over the past 3 weeks, I&#8217;ve built over 40 pairs of active/active cluster on Windows 2003.  I&#8217;ve looked around the web, to see if someone has any type of script that will help me, but alas, everyone wants to show me how to PnC (point &#038; click) my way thru the bullshit GUI.
Don&#8217;t get [...]]]></description>
			<content:encoded><![CDATA[<p>Over the past 3 weeks, I&#8217;ve built over 40 pairs of active/active cluster on Windows 2003.  I&#8217;ve looked around the web, to see if someone has any type of script that will help me, but alas, everyone wants to show me how to PnC (point &#038; click) my way thru the bullshit GUI.</p>
<p>Don&#8217;t get me wrong, I&#8217;m grateful for the GUI but when I&#8217;m setting up a crap load of A/A cluster servers, I want everything to be automated or as automated as possible.  I ended up writing my own script.  All you need to do is past in the correct variables and <font color="white">make sure you are on the server you are trying to create the shared folder.</font>  If not, you will definitely be in for a surprise!</p>
<a class="downloadlink dlimg" href="http://www.cbtr.net/download/setup_cluster_shares.zip" title="Version v0.1 downloaded 2 times" ><img src="http://www.cbtr.net/wp-content/plugins/download-monitor/img/downloads-icon.gif" alt="Download Create clustered resources Version v0.1" /></a>
]]></content:encoded>
			<wfw:commentRss>http://www.cbtr.net/2009/04/14/creating-windows-clustered-resources/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.cbtr.net/2009/04/14/creating-windows-clustered-resources/</feedburner:origLink></item>
		<item>
		<title>changing sql services password</title>
		<link>http://feedproxy.google.com/~r/cbtr/~3/KNQFX60H2Gs/</link>
		<comments>http://www.cbtr.net/2009/04/14/changing-sql-services-password/#comments</comments>
		<pubDate>Wed, 15 Apr 2009 04:00:56 +0000</pubDate>
		<dc:creator>Obe</dc:creator>
		
		<category><![CDATA[sql]]></category>

		<category><![CDATA[changing sql password]]></category>

		<category><![CDATA[changing sql services password]]></category>

		<category><![CDATA[resetting sql services password]]></category>

		<category><![CDATA[sql services password]]></category>

		<guid isPermaLink="false">http://www.cbtr.net/?p=333</guid>
		<description><![CDATA[In my environment, I have over 100+ servers and every so many days, the account that runs SQL services are changed and it is a bitch to change it via point and click on 100+ servers.
Internally, there&#8217;s a tool that we all can use to reset password for services except that it isn&#8217;t friendly when [...]]]></description>
			<content:encoded><![CDATA[<p>In my environment, I have over 100+ servers and every so many days, the account that runs SQL services are changed and it is a bitch to change it via point and click on 100+ servers.</p>
<p>Internally, there&#8217;s a tool that we all can use to reset password for services except that it isn&#8217;t friendly when you have active/active setup.  The following script changes all that via the use of powershell.  Of course, this is version 0.1.  version 0.2 will be written in C# but that&#8217;s for later.</p>
<p>The script will create a table in a database, you will then need to populate the table with the physical server, SQL instance name (not the virtual name!!).  Once that&#8217;s done, run the bottom portion of the script to output the powershell statement; which you will copy &#038; paste into a powershell cmd screen.</p>
<p>Once you pasted it, powershell will start executing all the commands.  After Powershell stop running the command, be sure to press &#8216;Enter&#8217; to make sure that the last command actually get executed.  I know it is still a bit manual but better then pointing and clicking thru 100+ servers to change a bloody password.</p>
<a class="downloadlink dlimg" href="http://www.cbtr.net/download/insert_srvPwdReset.zip" title="Version v0.1 downloaded 2 times" ><img src="http://www.cbtr.net/wp-content/plugins/download-monitor/img/downloads-icon.gif" alt="Download Change SQL services password Version v0.1" /></a>
]]></content:encoded>
			<wfw:commentRss>http://www.cbtr.net/2009/04/14/changing-sql-services-password/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.cbtr.net/2009/04/14/changing-sql-services-password/</feedburner:origLink></item>
		<item>
		<title>sql 2005 connection error</title>
		<link>http://feedproxy.google.com/~r/cbtr/~3/ejP3uwEl5BU/</link>
		<comments>http://www.cbtr.net/2009/04/10/sql-2005-connection-error/#comments</comments>
		<pubDate>Sat, 11 Apr 2009 02:56:52 +0000</pubDate>
		<dc:creator>Obe</dc:creator>
		
		<category><![CDATA[sql]]></category>

		<category><![CDATA[instance-specific error occurred]]></category>

		<category><![CDATA[SQLBrowser]]></category>

		<category><![CDATA[The server was not found or was not accessible]]></category>

		<category><![CDATA[Verify that the instance name is correct]]></category>

		<guid isPermaLink="false">http://www.cbtr.net/?p=327</guid>
		<description><![CDATA[Error:
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections.
I have a server named: virtualA\virtualSQLA.  This server was working fine a few days ago but [...]]]></description>
			<content:encoded><![CDATA[<p>Error:</p>
<p><font color="red">A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections.</font></p>
<p>I have a server named: virtualA\virtualSQLA.  This server was working fine a few days ago but after a server reboot, it was giving the above error message.  I was able to connect via its virtual name (virtualA) and virtualA\virtualSQLA,1433 but not virtualA\virtualSQLA.  After 20 minutes of looking around &#8230;.</p>
<p><font color="white">Check that SQLBrowser service is running!!!!!!</font></p>
]]></content:encoded>
			<wfw:commentRss>http://www.cbtr.net/2009/04/10/sql-2005-connection-error/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.cbtr.net/2009/04/10/sql-2005-connection-error/</feedburner:origLink></item>
		<item>
		<title>finding a bunch of server’s ip address</title>
		<link>http://feedproxy.google.com/~r/cbtr/~3/KqR211_AQCs/</link>
		<comments>http://www.cbtr.net/2009/03/31/finding-a-bunch-of-servers-ip-address/#comments</comments>
		<pubDate>Tue, 31 Mar 2009 19:40:37 +0000</pubDate>
		<dc:creator>Obe</dc:creator>
		
		<category><![CDATA[sql]]></category>

		<category><![CDATA[finding a bunch of server ip address]]></category>

		<category><![CDATA[getting ip address]]></category>

		<category><![CDATA[ip address]]></category>

		<category><![CDATA[powershell script to get ip address]]></category>

		<category><![CDATA[Win32_NetworkAdapterConfiguration]]></category>

		<guid isPermaLink="false">http://www.cbtr.net/?p=325</guid>
		<description><![CDATA[get-content server.txt&#124; foreach {
$strComputer = $_
$colItems = get-wmiobject -class &#8220;Win32_NetworkAdapterConfiguration&#8221; `
-computername $strComputer &#124; Where{$_.IpEnabled -Match &#8220;True&#8221;}
foreach ($objItem in $colItems) {
   write-host $strComputer &#8221; : &#8221; $objItem.IPAddress
}
}
in the server.txt file, one server per line and no extra space at the end of each server.
]]></description>
			<content:encoded><![CDATA[<p>get-content <font color = 'green'>server.txt</font>| foreach {<br />
$strComputer = $_<br />
$colItems = get-wmiobject -class &#8220;Win32_NetworkAdapterConfiguration&#8221; `<br />
-computername $strComputer | Where{$_.IpEnabled -Match &#8220;True&#8221;}<br />
foreach ($objItem in $colItems) {<br />
   write-host $strComputer &#8221; : &#8221; $objItem.IPAddress<br />
}<br />
}</p>
<p>in the server.txt file, one server per line and no extra space at the end of each server.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cbtr.net/2009/03/31/finding-a-bunch-of-servers-ip-address/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.cbtr.net/2009/03/31/finding-a-bunch-of-servers-ip-address/</feedburner:origLink></item>
		<item>
		<title>finding physical servername</title>
		<link>http://feedproxy.google.com/~r/cbtr/~3/rEMUuQn5cl0/</link>
		<comments>http://www.cbtr.net/2009/03/18/finding-physical-servername/#comments</comments>
		<pubDate>Thu, 19 Mar 2009 03:39:06 +0000</pubDate>
		<dc:creator>Obe</dc:creator>
		
		<category><![CDATA[sql]]></category>

		<category><![CDATA[computer name]]></category>

		<category><![CDATA[computer name of a sql instance]]></category>

		<category><![CDATA[finding the name of a sql instance]]></category>

		<category><![CDATA[getting the computer name of a sql instance]]></category>

		<category><![CDATA[sql instance computer name]]></category>

		<category><![CDATA[sql instance physical name]]></category>

		<guid isPermaLink="false">http://www.cbtr.net/?p=323</guid>
		<description><![CDATA[For some reason, I have a problem remembering server name but don&#8217;t have any problem remembering SQL name instances.  Maybe because I connect to the name instance more often then not.  But when someone ask me what&#8217;s the physical servername of so and so SQL name instances, i&#8217;m lost.
a co-worker showed me a [...]]]></description>
			<content:encoded><![CDATA[<p>For some reason, I have a problem remembering server name but don&#8217;t have any problem remembering SQL name instances.  Maybe because I connect to the name instance more often then not.  But when someone ask me what&#8217;s the physical servername of so and so SQL name instances, i&#8217;m lost.</p>
<p>a co-worker showed me a SQL function a few days ago that will tell you the physical servername of a SQL name instance:</p>
<p><font color="green">select serverproperty(&#8217;ComputerNamePhysicalNetBIOS&#8217;)</font></p>
<p>I have to look around some more to see if this function will allow me to identify clustered nodes, be it active/active or active/passive.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cbtr.net/2009/03/18/finding-physical-servername/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.cbtr.net/2009/03/18/finding-physical-servername/</feedburner:origLink></item>
		<item>
		<title>order by asc for two (2) columns</title>
		<link>http://feedproxy.google.com/~r/cbtr/~3/C8oa0zD-O9o/</link>
		<comments>http://www.cbtr.net/2009/03/16/order-by-asc-for-two-2-columns/#comments</comments>
		<pubDate>Tue, 17 Mar 2009 00:10:43 +0000</pubDate>
		<dc:creator>Obe</dc:creator>
		
		<category><![CDATA[sql]]></category>

		<category><![CDATA[order 2 columns]]></category>

		<category><![CDATA[order by 2 columns]]></category>

		<category><![CDATA[order by asc]]></category>

		<category><![CDATA[order by asc for two (2) columns]]></category>

		<category><![CDATA[sql order by asc]]></category>

		<guid isPermaLink="false">http://www.cbtr.net/?p=319</guid>
		<description><![CDATA[a co-worker today asked if there was a way to insert data from one table into another but sort the columns by ASC for BOTH columns.  For example, tableA has the following value:
rowid: 1,2,3,4
columnA: 3,7,1,6
columnB: 6,7,2,4
In his new table, he wants it to look like so (tableB):
rowid: 1,2,3,4
columnA: 1,3,6,7
columnB: 2,4,6,7
@ first, it should be [...]]]></description>
			<content:encoded><![CDATA[<p>a co-worker today asked if there was a way to insert data from one table into another but sort the columns by ASC for BOTH columns.  For example, tableA has the following value:</p>
<p>rowid: 1,2,3,4<br />
columnA: 3,7,1,6<br />
columnB: 6,7,2,4</p>
<p>In his new table, he wants it to look like so (tableB):</p>
<p>rowid: 1,2,3,4<br />
columnA: 1,3,6,7<br />
columnB: 2,4,6,7</p>
<p>@ first, it should be easy right?</p>
<p>insert into tableB(columnA, columnB)<br />
select columnA, columnB from tableA order by columnA, columnB</p>
<p>But that will only sort by columnA in asc.  ColumnB will not be sorted at all.  Instead I ended up doing:</p>
<p>insert into tableB(columnA)<br />
select columnA from tableA order by columnA</p>
<p>The above statement gives me the 1st column in ASC order, now for the 2nd:</p>
<p>update v1 set v1.columnB=v.columnB from<br />
(select ROW_NUMBER() OVER (order by columnB) as RowNumber, columnB<br />
from tableA ) v<br />
inner join tableB v1 on v.RowNumber=v1.Rowid</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cbtr.net/2009/03/16/order-by-asc-for-two-2-columns/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.cbtr.net/2009/03/16/order-by-asc-for-two-2-columns/</feedburner:origLink></item>
		<item>
		<title>Finding filesizes</title>
		<link>http://feedproxy.google.com/~r/cbtr/~3/NtEjB_EYoIg/</link>
		<comments>http://www.cbtr.net/2009/02/06/finding-filesizes/#comments</comments>
		<pubDate>Fri, 06 Feb 2009 19:34:05 +0000</pubDate>
		<dc:creator>Obe</dc:creator>
		
		<category><![CDATA[sql]]></category>

		<category><![CDATA[finding 0kb files]]></category>

		<category><![CDATA[finding file size]]></category>

		<category><![CDATA[finding the size of a file]]></category>

		<guid isPermaLink="false">http://www.cbtr.net/?p=315</guid>
		<description><![CDATA[Yesterday, I was tasked w/ finding and identify the filesize of some files located in some directory.  SQL doesn&#8217;t really have a function to do this and neither does a straight up DOS&#8217; dir command.
Forunately, the Internet is a big place and someone wrote a one line syntax to do what I needed.
@echo off
for [...]]]></description>
			<content:encoded><![CDATA[<p>Yesterday, I was tasked w/ finding and identify the filesize of some files located in some directory.  SQL doesn&#8217;t really have a function to do this and neither does a straight up DOS&#8217; dir command.</p>
<p>Forunately, the Internet is a big place and someone wrote a one line syntax to do what I needed.</p>
<p><font color=green><code>@echo off<br />
for %%a in (E:\path\to\files\*.*) do (if %%~za GEQ 0	(echo %%~za	%%a)	)   )</code></font></p>
<p>I took this code, put it into a DOS .bat file, output the call to a .txt file, and then finally bulk inserting it into a table for SQL to crunch thru.  With over 300GB of files in my directory, it took roughly 18seconds to complete the entire process.</p>
<p>I made some changes to what files were being stored in my directory and cut the process down to less than a second.</p>
<p><font color=green><code>set @cmdListing = '\\path\to\batch\file\filesize_listing.bat > \\path\to\output_listing.txt'</p>
<p>exec xp_cmdshell @cmdListing</p>
<p>bulk insert dbname..fileSizesTable from 'E:\path\to\output_file\output_listing.txt'</p>
<p></code></font></p>
<p>After this, it was basically a select statement to find out if my kb column in the fileSizesTable column contains any 0.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cbtr.net/2009/02/06/finding-filesizes/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.cbtr.net/2009/02/06/finding-filesizes/</feedburner:origLink></item>
		<item>
		<title>Reviewing Job History</title>
		<link>http://feedproxy.google.com/~r/cbtr/~3/HscRhN8bt4w/</link>
		<comments>http://www.cbtr.net/2008/12/03/reviewing-job-history/#comments</comments>
		<pubDate>Wed, 03 Dec 2008 22:44:17 +0000</pubDate>
		<dc:creator>Obe</dc:creator>
		
		<category><![CDATA[sql]]></category>

		<category><![CDATA[job history]]></category>

		<category><![CDATA[review job history]]></category>

		<category><![CDATA[sql job history]]></category>

		<category><![CDATA[t-sql sql job history]]></category>

		<guid isPermaLink="false">http://www.cbtr.net/?p=313</guid>
		<description><![CDATA[Everything a job fail, I used to look at the job history via the GUI.  Today, I finally got sick of the stupid ass GUI because when the job history history contains a lot of entry, the damn thing times out or takes FOREVER and you got people breathing down your back asking why [...]]]></description>
			<content:encoded><![CDATA[<p>Everything a job fail, I used to look at the job history via the GUI.  Today, I finally got sick of the stupid ass GUI because when the job history history contains a lot of entry, the damn thing times out or takes FOREVER and you got people breathing down your back asking why the hell the job failed.</p>
<p>Seriously.  3 months archive of a job history sounds decent but when the job runs every freaking minute, it still takes a while to load.  So the following query will help you ID the error message faster, via T-SQL.  No overhead and no headaches, except for troubleshooting the error of course.  For additional information, look to BOL.</p>
<blockquote><p><code><font color = 'green'>exec msdb..sp_help_jobhistory<br />
@job_name = &#8216;Name of your job&#8217;<br />
, @run_status = 0<br />
, @MODE = N&#8217;FULL&#8217;</font></code></p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.cbtr.net/2008/12/03/reviewing-job-history/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.cbtr.net/2008/12/03/reviewing-job-history/</feedburner:origLink></item>
	</channel>
</rss>
