<?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>Ctrl+Shift+B</title>
	<atom:link href="http://ctrlshiftb.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://ctrlshiftb.wordpress.com</link>
	<description>Build IT and they will come ...</description>
	<lastBuildDate>Thu, 29 Dec 2011 01:35:16 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='ctrlshiftb.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Ctrl+Shift+B</title>
		<link>http://ctrlshiftb.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://ctrlshiftb.wordpress.com/osd.xml" title="Ctrl+Shift+B" />
	<atom:link rel='hub' href='http://ctrlshiftb.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Programming Poetry = FAIL</title>
		<link>http://ctrlshiftb.wordpress.com/2011/01/07/programming-poetry-fail/</link>
		<comments>http://ctrlshiftb.wordpress.com/2011/01/07/programming-poetry-fail/#comments</comments>
		<pubDate>Fri, 07 Jan 2011 16:36:58 +0000</pubDate>
		<dc:creator>ctrlshiftbryan</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://ctrlshiftb.wordpress.com/?p=426</guid>
		<description><![CDATA[programming and poetry should never ever ever be combined. this does, however, explain jsonp in 26 words. i have a new friend named jason p. he likes to consume with me we call cross-domain but have to refrain from POSTing requests that&#8217;s insane<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ctrlshiftb.wordpress.com&amp;blog=6856134&amp;post=426&amp;subd=ctrlshiftb&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>programming and poetry should never ever ever be combined. this does, however, explain jsonp in 26 words.</p>
<p>i have a new friend named jason p.<br />
he likes to consume with me<br />
we call cross-domain<br />
but have to refrain<br />
from POSTing requests<br />
that&#8217;s insane</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ctrlshiftb.wordpress.com/426/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ctrlshiftb.wordpress.com/426/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ctrlshiftb.wordpress.com/426/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ctrlshiftb.wordpress.com/426/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ctrlshiftb.wordpress.com/426/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ctrlshiftb.wordpress.com/426/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ctrlshiftb.wordpress.com/426/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ctrlshiftb.wordpress.com/426/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ctrlshiftb.wordpress.com/426/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ctrlshiftb.wordpress.com/426/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ctrlshiftb.wordpress.com/426/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ctrlshiftb.wordpress.com/426/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ctrlshiftb.wordpress.com/426/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ctrlshiftb.wordpress.com/426/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ctrlshiftb.wordpress.com&amp;blog=6856134&amp;post=426&amp;subd=ctrlshiftb&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ctrlshiftb.wordpress.com/2011/01/07/programming-poetry-fail/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/48f50f7d3617aa50f19993dec175a007?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ctrlshiftbryan</media:title>
		</media:content>
	</item>
		<item>
		<title>Been feeling kinda Anti-AJAX</title>
		<link>http://ctrlshiftb.wordpress.com/2011/01/05/been-feeling-kinda-anti-ajax/</link>
		<comments>http://ctrlshiftb.wordpress.com/2011/01/05/been-feeling-kinda-anti-ajax/#comments</comments>
		<pubDate>Wed, 05 Jan 2011 21:56:54 +0000</pubDate>
		<dc:creator>ctrlshiftbryan</dc:creator>
				<category><![CDATA[JQuery]]></category>

		<guid isPermaLink="false">https://ctrlshiftb.wordpress.com/2011/01/05/been-feeling-kinda-anti-ajax/</guid>
		<description><![CDATA[Lately I’ve been trying to curb the overuse of AJAX. Basically it’s great that we can make all these calls to the server, but why make things so complicated. Why not just send all the data to the page and then handle it on the client side. Thinking back to those kool Hello World Hello [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ctrlshiftb.wordpress.com&amp;blog=6856134&amp;post=420&amp;subd=ctrlshiftb&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Lately I’ve been trying to curb the overuse of AJAX. Basically it’s great that we can make all these calls to the server, but why make things so complicated. Why not just send all the data to the page and then handle it on the client side.</p>
<p>Thinking back to those kool <s>Hello World </s>Hello Ajax demo’s we all did back in 05 I wanted to revisit the classic cascading drop down scenario. </p>
<p>Let&#8217;s make it even easier and leave out JSON, JavaScript arrays and large methods (and by large I mean more than 5 lines) of JavaScript. Let’s let the DOM store the data and a couple lines of JQuery to do the rest.</p>
<p>I won’t bore you with the server side (use what every you want I)but here is the client side HTML. </p>
<p><a href="http://ctrlshiftb.files.wordpress.com/2011/01/image.png"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;border-top:0;border-right:0;padding-top:0;margin:0 5px;" title="image" border="0" alt="image" src="http://ctrlshiftb.files.wordpress.com/2011/01/image_thumb.png?w=471&#038;h=574" width="471" height="574" /></a></p>
<p>The child dropdown contains all of the possible values and all options should initially be hidden. We are going to use the class of the option to store it’s parent ID. That is the key. </p>
<p>&#160;</p>
<p>Then all we have to do is write a few lines of JQuery like this…</p>
<p><a href="http://ctrlshiftb.files.wordpress.com/2011/01/image1.png"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;border-top:0;border-right:0;padding-top:0;margin:0 5px;" title="image" border="0" alt="image" src="http://ctrlshiftb.files.wordpress.com/2011/01/image_thumb1.png?w=500&#038;h=215" width="500" height="215" /></a></p>
<p>&#160;</p>
<p>And that’s it. </p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ctrlshiftb.wordpress.com/420/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ctrlshiftb.wordpress.com/420/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ctrlshiftb.wordpress.com/420/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ctrlshiftb.wordpress.com/420/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ctrlshiftb.wordpress.com/420/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ctrlshiftb.wordpress.com/420/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ctrlshiftb.wordpress.com/420/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ctrlshiftb.wordpress.com/420/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ctrlshiftb.wordpress.com/420/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ctrlshiftb.wordpress.com/420/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ctrlshiftb.wordpress.com/420/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ctrlshiftb.wordpress.com/420/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ctrlshiftb.wordpress.com/420/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ctrlshiftb.wordpress.com/420/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ctrlshiftb.wordpress.com&amp;blog=6856134&amp;post=420&amp;subd=ctrlshiftb&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ctrlshiftb.wordpress.com/2011/01/05/been-feeling-kinda-anti-ajax/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/48f50f7d3617aa50f19993dec175a007?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ctrlshiftbryan</media:title>
		</media:content>

		<media:content url="http://ctrlshiftb.files.wordpress.com/2011/01/image_thumb.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://ctrlshiftb.files.wordpress.com/2011/01/image_thumb1.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
		<item>
		<title>Sigh&#8230;</title>
		<link>http://ctrlshiftb.wordpress.com/2010/10/05/sigh/</link>
		<comments>http://ctrlshiftb.wordpress.com/2010/10/05/sigh/#comments</comments>
		<pubDate>Tue, 05 Oct 2010 20:14:24 +0000</pubDate>
		<dc:creator>ctrlshiftbryan</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[complaining]]></category>
		<category><![CDATA[worst practices]]></category>
		<category><![CDATA[wtf]]></category>

		<guid isPermaLink="false">http://ctrlshiftb.wordpress.com/?p=412</guid>
		<description><![CDATA[working a new project. no documentation at all. i did find one comment in the code so far which i have shared below. /* This is terrible logic, but we didn&#8217;t know about this until the last minute so there wasn&#8217;t time to add to DB */ Bryan<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ctrlshiftb.wordpress.com&amp;blog=6856134&amp;post=412&amp;subd=ctrlshiftb&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>working a new project. no documentation at all. i did find one comment in the code so far which i have shared below.</p>
<p>/* This is terrible logic, but we didn&#8217;t know about this until the last minute so there wasn&#8217;t time to add to DB */</p>
<p>Bryan</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ctrlshiftb.wordpress.com/412/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ctrlshiftb.wordpress.com/412/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ctrlshiftb.wordpress.com/412/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ctrlshiftb.wordpress.com/412/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ctrlshiftb.wordpress.com/412/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ctrlshiftb.wordpress.com/412/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ctrlshiftb.wordpress.com/412/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ctrlshiftb.wordpress.com/412/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ctrlshiftb.wordpress.com/412/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ctrlshiftb.wordpress.com/412/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ctrlshiftb.wordpress.com/412/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ctrlshiftb.wordpress.com/412/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ctrlshiftb.wordpress.com/412/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ctrlshiftb.wordpress.com/412/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ctrlshiftb.wordpress.com&amp;blog=6856134&amp;post=412&amp;subd=ctrlshiftb&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ctrlshiftb.wordpress.com/2010/10/05/sigh/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/48f50f7d3617aa50f19993dec175a007?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ctrlshiftbryan</media:title>
		</media:content>
	</item>
		<item>
		<title>Database Code Deployments</title>
		<link>http://ctrlshiftb.wordpress.com/2010/08/02/database-code-deployments/</link>
		<comments>http://ctrlshiftb.wordpress.com/2010/08/02/database-code-deployments/#comments</comments>
		<pubDate>Mon, 02 Aug 2010 23:07:53 +0000</pubDate>
		<dc:creator>Ron</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[MSSQL]]></category>
		<category><![CDATA[SQL Server 2000]]></category>
		<category><![CDATA[SQL Server 2005]]></category>
		<category><![CDATA[SQL Server 2008]]></category>
		<category><![CDATA[T-SQL]]></category>

		<guid isPermaLink="false">https://ctrlshiftb.wordpress.com/2010/08/02/database-code-deployments/</guid>
		<description><![CDATA[One of the responsibilities of my current position as a SQL Developer is to prepare the scripts for deployment. For quality assurance reasons we store all of the database objects in a source control system, so each object is stored in a separate file. This can make deployments very tedious, depending on the volume of [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ctrlshiftb.wordpress.com&amp;blog=6856134&amp;post=408&amp;subd=ctrlshiftb&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>One of the responsibilities of my current position as a SQL Developer is to prepare the scripts for deployment. For quality assurance reasons we store all of the database objects in a source control system, so each object is stored in a separate file. This can make deployments very tedious, depending on the volume of files.</p>
<h3>Disclaimer</h3>
<p>These processes are my processes for an internally managed application. These scripts and processes are not distributed in any way, and quite frankly are not suited for that purpose.</p>
<p>This does not cover any T-SQL best practices. There are far better articles written by far more knowledgeable people covering these topics. Click <a href="http://lmgtfy.com/?q=t-sql+best+practices">here</a> for a list of best practice articles.</p>
<h3>The Development</h3>
<p>Here are my general guidelines for deployment, in no particular order:</p>
<p><strong>1. Each script must be able to be executed multiple times without error.</strong></p>
<p>There is nothing worse that running a script to test a deployment and then getting an error because an object already exists or a key violation because the data already exists. All scripts must check for the existence of the finals state before doing anything else. For stored procedures, this may me a conditional drop and then create and for tables this may mean checking for column existence before running an alter statement.</p>
<p><strong>2. Object permission must be part of the object script.</strong></p>
<p>Your mileage may vary with this one, but I am a fan of explicit permission granted to a database role for each database object that is being deployed. For newer architectures your roles may have blanket permissions to a schema, but I have not seen many instances of security set up this way.</p>
<p>Having the permission set at the end of the script (just in case you drop an re-create it <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> ) will save a lot of headache if you ever need to setup the application in a new environment. <strong>NOTE:</strong> Please do not forget the batch separator (i.e. “GO”) in the script. I hate seeing permission errors where a stored procedure is trying execute permissions to itself.</p>
<p><strong>3. Group the data scripts by table.</strong></p>
<p>If you follow guideline #1 this shouldn’t be much of an issue, but if you have the same or worse, similar, updates in multiple places you could in a world of hurt.</p>
<p><strong>4. Try to group like objects.</strong></p>
<p>I try to keep like objects together. With some exceptions I will deploy objects in the following order:</p>
<ol>
<li><strong>Tables – </strong>With the exception of using a function in a default value or check constraint, it is a pretty safe bet that you can deploy all table changes first without error. The most tedious part of deploying tables is their relationships. Since they are dependant on one another, order is important. I have not found a perfect way to deal with this dependency.</li>
<li><strong>Views – </strong>Again, it is possible to use functions as part of a view, but I wouldn’t recommend it. It is also possible to reference another view as part of a view definition, but I would not recommend that either. Pay attention to the order, just in case.</li>
<li><strong>Functions – </strong>In SQL Sever you cannot call a stored procedure as part of a scalar or table valued function, so deploying these before the stored procedures is advisable.</li>
<li><strong>Stored Procedures – </strong>These are next to last because they can use any of the previous three objects. They may, however, be dependant on one another, so watch the order here as well.</li>
<li><strong>Triggers – </strong>Triggers can be added to tables or view and they can use stored procedure or functions, so I save these for last.</li>
</ol>
<p><strong>5. Take as much care with the rollback scripts as you do with the future scripts.</strong></p>
<p>What can be worse than beginning a deployment and then realizing that you have to rollback. After the rollback completes, you realize that you just dropped a primary table in your database that you just meant to alter. Oops.</p>
<p>For this reason I will hand write table rollback scripts. I use a script generator like <a href="http://scriptdb.codeplex.com/">ScriptDB</a> to generate all of the other rollback scripts a week or so prior to deployment to capture any run fixes that were deployed during the development process.</p>
<p>I maintain a 1:1 relationship between deployment and rollback scripts. I execute the rollback scripts in reverse order to the deployments scripts. No muss, no fuss and no additional lists of scripts to maintain.</p>
<p><strong>6. Don’t forget the jobs!</strong></p>
<p>If you update requires job changes, add those to source control for deployment as well. All of the objects that are part of the deployment should be scripted.</p>
<p><strong>7. Store the deployment order some place safe.</strong></p>
<p>The largest deployment that I have worked on to date was over 600 individual scripts, with many exceptions to the steps listed above. Rebuilding that list would have taken a large amount of effort and testing, which I really did not have the time to do.</p>
<p>I prefer to store them in a database table table so that the list is available to other developers to make the necessary changes. I never want to be the one left holding the ball, let alone the one to drop, so let’s keep this in a safe place.</p>
<h3>The Deployment</h3>
<p>Take the list that you have so tediously maintained throughout the development process and script it into a file. I use <a href="http://msdn.microsoft.com/en-us/library/ms162773.aspx">sqlcmd</a> to deploy all of the database objects, so this is a relatively simple process. Be sure that error handling is written into the script. I prefer that the batch ends when an error is encountered. If you followed #1 above, you can fix any errors and start the batch from the beginning.</p>
<p>The table that I use to store the scripts has the definition below. I have a template parameter for the database in the script. Use Ctrl+Shift+M or click the e “Specify Values for Template Parameters” button to populate this field.</p>
<p><pre class="brush: sql;">
USE &lt;Database,,&gt; ;
GO
IF EXISTS ( SELECT
                *
            FROM
                sys.objects
            WHERE
                object_id = OBJECT_ID(N'[dbo].[SQLScripts]') AND
                type IN ( N'U' ) )
    DROP TABLE [dbo].[SQLScripts]
GO
SET ANSI_NULLS ON ;
GO
SET QUOTED_IDENTIFIER ON ;
GO
SET ANSI_PADDING ON ;
GO
CREATE TABLE dbo.SQLScripts
    (
      SQLScriptOrder SMALLINT NOT NULL,
      SQLScriptDatabase VARCHAR(255) NOT NULL,
      SQLScriptName VARCHAR(255) NOT NULL,
      SQLScriptRelativePath VARCHAR(255) NOT NULL,
      CreateTimeStamp DATETIME NOT NULL
                               CONSTRAINT DF_SQLScripts_CreatedTimeStamp DEFAULT ( GETDATE() ),
      CreateUserID VARCHAR(50) NOT NULL
                               CONSTRAINT DF_SQLScripts_CreateUserID DEFAULT ( SUSER_SNAME() ),
      UpdateTimeStamp DATETIME NOT NULL
                               CONSTRAINT DF_SQLScripts_UpdatedTimeStamp DEFAULT ( GETDATE() ),
      UpdateUserID VARCHAR(50) NOT NULL
                               CONSTRAINT DF_SQLScripts_UpdateUserID DEFAULT ( SUSER_SNAME() ),
      CONSTRAINT PK_SQLScripts PRIMARY KEY CLUSTERED ( SQLScriptOrder ASC ),
      CONSTRAINT AK_SQLScripts UNIQUE ( SQLScriptDatabase ASC, SQLScriptName ASC )
    ) ;
GO
CREATE TRIGGER dbo.SQLScriptUpdate ON dbo.SQLScripts
    AFTER UPDATE
AS
UPDATE
    ss
SET
    UpdateTimeStamp = GETDATE(),
    UpdateUserID = SUSER_NAME()
FROM
    dbo.SQLScripts ss
WHERE
    EXISTS ( SELECT
                1
             FROM
                INSERTED i
             WHERE
                i.SQLScriptDatabase = ss.SQLScriptDatabase AND
                i.SQLScriptName = ss.SQLScriptName ) ;
</pre></p>
<p>To create the batch file used for deployment I use to SQL outlined below. I find this option to be very flexible. Run the result to text. I hate to use cursors like everyone else, but this ensures that I get the proper format out.</p>
<p><pre class="brush: sql;">
SET NOCOUNT ON ;
DECLARE
    @Server VARCHAR(50),
    @LocalPath VARCHAR(255),
    @SQLScriptRelativePath VARCHAR(255),
    @SQLScriptName VARCHAR(255),
    @Command VARCHAR(1000) ;

SET @Server = '(local)' ;
SET @LocalPath = 'C:\Temp' ;

PRINT 'REM Deployment Script Generator'
PRINT 'REM Generated On: ' + CONVERT(VARCHAR(10), GETDATE(), 101)
PRINT 'REM Server Name: ' + @Server ;
PRINT '' ;

DECLARE ScriptCursor CURSOR LOCAL FORWARD_ONLY READ_ONLY
    FOR SELECT
            SQLScriptRelativePath,
            SQLScriptName
        FROM
            dbo.SQLScripts
        ORDER BY
            SQLScriptOrder ;

OPEN ScriptCursor ;

FETCH NEXT FROM ScriptCursor INTO @SQLScriptRelativePath,@SQLScriptName ;
WHILE @@FETCH_STATUS = 0
    BEGIN
        PRINT 'REM ' + @SQLScriptRelativePath + '\' + @SQLScriptName ;
        PRINT 'sqlcmd -S ' + @Server + ' -i &quot;' + @LocalPath + '\' + @SQLScriptRelativePath + '\' + @SQLScriptName + '&quot;' ;
        PRINT 'if not %errorlevel%==0 goto :error' ;

        FETCH NEXT FROM ScriptCursor INTO @SQLScriptRelativePath,@SQLScriptName ;
    END ;

CLOSE ScriptCursor ;
DEALLOCATE ScriptCursor ;

PRINT '' ;
PRINT 'pause' ;
PRINT 'exit' ;
PRINT '' ;
PRINT ':error' ;
PRINT 'echo ERROR ENCOUNTERED' ;
PRINT 'pause' ;
</pre></p>
<p>Take the output of this script and save it as a batch file and VIOLA! Change the local path and order the scripts in reverse order to generate the rollback batch file.</p>
<p>Now you have a quick, dependable and free SQL deployment method.</p>
<p>Happy querying,</p>
<p><strong>~Ron</strong></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ctrlshiftb.wordpress.com/408/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ctrlshiftb.wordpress.com/408/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ctrlshiftb.wordpress.com/408/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ctrlshiftb.wordpress.com/408/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ctrlshiftb.wordpress.com/408/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ctrlshiftb.wordpress.com/408/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ctrlshiftb.wordpress.com/408/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ctrlshiftb.wordpress.com/408/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ctrlshiftb.wordpress.com/408/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ctrlshiftb.wordpress.com/408/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ctrlshiftb.wordpress.com/408/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ctrlshiftb.wordpress.com/408/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ctrlshiftb.wordpress.com/408/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ctrlshiftb.wordpress.com/408/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ctrlshiftb.wordpress.com&amp;blog=6856134&amp;post=408&amp;subd=ctrlshiftb&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ctrlshiftb.wordpress.com/2010/08/02/database-code-deployments/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c6a2612be610d0db88d98f1c5f6aa528?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">caranthir</media:title>
		</media:content>
	</item>
		<item>
		<title>Refeshing Views</title>
		<link>http://ctrlshiftb.wordpress.com/2010/07/01/refeshing-views/</link>
		<comments>http://ctrlshiftb.wordpress.com/2010/07/01/refeshing-views/#comments</comments>
		<pubDate>Thu, 01 Jul 2010 20:19:36 +0000</pubDate>
		<dc:creator>Ron</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[MSSQL]]></category>
		<category><![CDATA[SQL Server 2000]]></category>
		<category><![CDATA[SQL Server 2005]]></category>
		<category><![CDATA[SQL Server 2008]]></category>
		<category><![CDATA[T-SQL]]></category>

		<guid isPermaLink="false">http://ctrlshiftb.wordpress.com/?p=404</guid>
		<description><![CDATA[Running on a recently updated to SQL Server 2005 cluster, we were noticing some performance issues with one stored procedure in particular. We initially blamed the issue on optimizer changes, but were looking a fix that did not involve and object change. Someone came up with the idea (not me) to refresh the view. I [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ctrlshiftb.wordpress.com&amp;blog=6856134&amp;post=404&amp;subd=ctrlshiftb&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Running on a recently updated to SQL Server 2005 cluster, we were noticing some performance issues with one stored procedure in particular. We initially blamed the issue on optimizer changes, but were looking a fix that did not involve and object change.</p>
<p>Someone came up with the idea (not me) to refresh the view. I am aware that a view that contains the dreaded &#8220;SELECT *&#8221; may not contain new table columns until the view is refreshed, but I have never actually run into this issue in real life. In our situation the view definition had not changed, nor had the underlying objects, but refreshing the view resolved the performance issues.</p>
<p>So on that note i wrote a quick little cursor up refresh all views in a database. I hope someone finds this useful.</p>
<p><pre class="brush: sql;">
/*******************************************************************************
Name:			Refresh Views
Description:	Declare our variables and cursor. The cursor looks at and 
                schema bound views since the are not able to be refreshed.
Dependencies:	
Testing:		
********************************************************************************
Author - Date - Change Description
--------------------------------------------------------------------------------
Ron Carpenter - 07/01/2010 - Initial Version
*******************************************************************************/
DECLARE @View varchar(255) ;

DECLARE ViewCursor CURSOR LOCAL READ_ONLY FORWARD_ONLY
    FOR SELECT
            [Name]
        FROM
            sys.objects o
        WHERE
            Type_Desc = 'VIEW' AND
            NOT EXISTS (SELECT
                            1
                        FROM
                            sys.sql_dependencies d
                        WHERE
                            o.object_id = d.object_id AND
                            d.class = 1)

OPEN ViewCursor ;

FETCH NEXT FROM ViewCursor INTO @View ;
WHILE @@FETCH_STATUS = 0 
    BEGIN
        EXECUTE sp_refreshview @View ;

        FETCH NEXT FROM ViewCursor INTO @View ;
    END ;

CLOSE ViewCursor ;
DEALLOCATE ViewCursor ;
</pre></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ctrlshiftb.wordpress.com/404/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ctrlshiftb.wordpress.com/404/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ctrlshiftb.wordpress.com/404/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ctrlshiftb.wordpress.com/404/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ctrlshiftb.wordpress.com/404/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ctrlshiftb.wordpress.com/404/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ctrlshiftb.wordpress.com/404/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ctrlshiftb.wordpress.com/404/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ctrlshiftb.wordpress.com/404/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ctrlshiftb.wordpress.com/404/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ctrlshiftb.wordpress.com/404/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ctrlshiftb.wordpress.com/404/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ctrlshiftb.wordpress.com/404/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ctrlshiftb.wordpress.com/404/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ctrlshiftb.wordpress.com&amp;blog=6856134&amp;post=404&amp;subd=ctrlshiftb&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ctrlshiftb.wordpress.com/2010/07/01/refeshing-views/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c6a2612be610d0db88d98f1c5f6aa528?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">caranthir</media:title>
		</media:content>
	</item>
		<item>
		<title>Display Job History</title>
		<link>http://ctrlshiftb.wordpress.com/2010/05/27/display-job-history/</link>
		<comments>http://ctrlshiftb.wordpress.com/2010/05/27/display-job-history/#comments</comments>
		<pubDate>Thu, 27 May 2010 01:08:50 +0000</pubDate>
		<dc:creator>Ron</dc:creator>
				<category><![CDATA[RDBMS]]></category>
		<category><![CDATA[SQL Server]]></category>

		<guid isPermaLink="false">http://ctrlshiftb.wordpress.com/?p=391</guid>
		<description><![CDATA[We have a service that polls a myriad of things several times an hour to send pages and alerts to the appropriate people based on a specific set of criteria. One of the things that it polls is the SQL job history, which can be helpful to be proactive in catching long running jobs or [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ctrlshiftb.wordpress.com&amp;blog=6856134&amp;post=391&amp;subd=ctrlshiftb&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>We have a service that polls a myriad of things several times an hour to send pages and alerts to the appropriate people based on a specific set of criteria. One of the things that it polls is the SQL job history, which can be helpful to be proactive in catching long running jobs or even if a job gets disabled. </p>
<p>The time that a job is scheduled to run and it&#8217;s run duration is saved as an integer in hhmmss format, so converting this to the datetime datatype requires some manipulation. You can find a lot of ways to do this using string functions, which is the way we had completed the conversion &#8230; until is started erroring. </p>
<p>The statement below will convert the Integer value to the datetime datatype using mathmatical functions instead of string functions, which is less prone to error. </p>
<p>The first thing that we will do is extract the hours, minutes and seconds into their separate parts using the modulo operator. Once we have that we will convert these values into seconds (the smallest interval we are working with) and add them together. Once we have the offset value in seconds from midnight we use the dateadd function and add the seconds to the run date. Viola!  And it&#8217;s even a little faster. </p>
<p><pre class="brush: sql;">
SELECT
    DATEADD(ss,(((Run_Time - Run_Time % 10000) / 1e4) * 36e2 + 
                ((Run_Time % 10000 - Run_Time % 100) / 1e2) * 6e1 + 
                  Run_Time % 100),CAST(CAST(Run_Date AS char(8)) AS datetime)) StartTime,
    DATEADD(ss,(((Run_Time - Run_Time % 10000) / 1e4) * 36e2 + 
                ((Run_Time % 10000 - Run_Time % 100) / 1e2) * 6e1 + 
                  Run_Time % 100 + 
                ((Run_Duration - Run_Duration % 10000) / 1e4) * 36e2 + 
                ((Run_Duration % 10000 - Run_Duration % 100) / 1e2) * 6e1 + 
                  Run_Duration % 100),CAST(CAST(Run_Date AS char(8)) AS datetime)) EndTime,
    j.name JobName,
    jh.step_name StepName
FROM
    msdb.dbo.sysjobhistory jh
INNER JOIN msdb.dbo.sysjobs j
    ON jh.job_id = j.job_id
WHERE
    jh.step_id &gt; 0
ORDER BY
    j.job_id,
    jh.step_id ;
</pre></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ctrlshiftb.wordpress.com/391/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ctrlshiftb.wordpress.com/391/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ctrlshiftb.wordpress.com/391/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ctrlshiftb.wordpress.com/391/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ctrlshiftb.wordpress.com/391/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ctrlshiftb.wordpress.com/391/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ctrlshiftb.wordpress.com/391/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ctrlshiftb.wordpress.com/391/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ctrlshiftb.wordpress.com/391/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ctrlshiftb.wordpress.com/391/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ctrlshiftb.wordpress.com/391/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ctrlshiftb.wordpress.com/391/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ctrlshiftb.wordpress.com/391/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ctrlshiftb.wordpress.com/391/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ctrlshiftb.wordpress.com&amp;blog=6856134&amp;post=391&amp;subd=ctrlshiftb&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ctrlshiftb.wordpress.com/2010/05/27/display-job-history/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<georss:point>40.082870 -83.093770</georss:point>
		<geo:lat>40.082870</geo:lat>
		<geo:long>-83.093770</geo:long>
		<media:content url="http://0.gravatar.com/avatar/c6a2612be610d0db88d98f1c5f6aa528?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">caranthir</media:title>
		</media:content>
	</item>
		<item>
		<title>Efficient way to do Paging in SQL Server</title>
		<link>http://ctrlshiftb.wordpress.com/2010/04/26/efficient-way-to-do-paging-in-sql-server/</link>
		<comments>http://ctrlshiftb.wordpress.com/2010/04/26/efficient-way-to-do-paging-in-sql-server/#comments</comments>
		<pubDate>Mon, 26 Apr 2010 19:51:16 +0000</pubDate>
		<dc:creator>Raja</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server 2005]]></category>

		<guid isPermaLink="false">http://ctrlshiftb.wordpress.com/?p=384</guid>
		<description><![CDATA[I was going through SQLServerCentral.com and found this pretty nice article to do paging in an efficient manner. So thought of sharing with you all and ofcourse it is a note to myself Happy Programming!!! Cheers, Raja<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ctrlshiftb.wordpress.com&amp;blog=6856134&amp;post=384&amp;subd=ctrlshiftb&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I was going through SQLServerCentral.com and found this pretty nice <a title="SQLServerCentral.com" href="http://www.sqlservercentral.com/articles/paging/69892/" target="_blank">article </a>to do paging in an efficient manner. So thought of sharing with you all and ofcourse it is a note to myself <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p><pre class="brush: sql;">

WITH Keys
AS
(
 SELECT
 TOP (@PageNumber * @PageSize)
 rn = ROW_NUMBER() OVER (ORDER BY P1.Post_ID ASC)
 P1.Post_ID
 FROM
 dbo.Post P1
 ORDER BY
 P1.Post_ID ASC
),
SelectedKeys AS
(
 SELECT
 Top(@PageSize)
 SK.rn,
 SK.Post_ID
 FROM
 Keys SK
 WHERE
 SK.rn &gt;((@PageNumber -1 ) * @PageSize)
 ORDER BY
 SK.Post_ID ASC
)
SELECT
 SK.rn,
 P2.Post_ID,
 P2.Thread_ID,
 P2.Member_ID,
 P2.Created_Date,
 P2.Title,
 P2.Body
FROM
 SelectedKeys SK
JOIN
 dbo.Post P2
ON
 P2.Post_ID = SK.Post_ID
ORDER BY
 SK.Post_ID ASC

</pre></p>
<p>Happy Programming!!!</p>
<p>Cheers,</p>
<p>Raja</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ctrlshiftb.wordpress.com/384/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ctrlshiftb.wordpress.com/384/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ctrlshiftb.wordpress.com/384/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ctrlshiftb.wordpress.com/384/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ctrlshiftb.wordpress.com/384/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ctrlshiftb.wordpress.com/384/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ctrlshiftb.wordpress.com/384/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ctrlshiftb.wordpress.com/384/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ctrlshiftb.wordpress.com/384/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ctrlshiftb.wordpress.com/384/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ctrlshiftb.wordpress.com/384/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ctrlshiftb.wordpress.com/384/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ctrlshiftb.wordpress.com/384/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ctrlshiftb.wordpress.com/384/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ctrlshiftb.wordpress.com&amp;blog=6856134&amp;post=384&amp;subd=ctrlshiftb&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ctrlshiftb.wordpress.com/2010/04/26/efficient-way-to-do-paging-in-sql-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/26dfe8b9667b6d2599d465f051fc3a1c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Raja</media:title>
		</media:content>
	</item>
		<item>
		<title>Getting the controlname which caused postback</title>
		<link>http://ctrlshiftb.wordpress.com/2010/04/15/getting-the-controlname-which-caused-postback/</link>
		<comments>http://ctrlshiftb.wordpress.com/2010/04/15/getting-the-controlname-which-caused-postback/#comments</comments>
		<pubDate>Thu, 15 Apr 2010 16:37:59 +0000</pubDate>
		<dc:creator>Raja</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[ASP .NET]]></category>
		<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://ctrlshiftb.wordpress.com/?p=379</guid>
		<description><![CDATA[I am working on a site in which I use a lot of JQuery but there are some pages which I had to use Server Controls and there was a need to get which control caused the postback.  After a bit of searching I found this nice method which did the trick. Happy Programming!!! Cheers, [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ctrlshiftb.wordpress.com&amp;blog=6856134&amp;post=379&amp;subd=ctrlshiftb&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I am working on a site in which I use a lot of JQuery but there are some pages which I had to use Server Controls and there was a need to get which control caused the postback.  After a bit of searching I found this nice method which did the trick.</p>
<p><pre class="brush: csharp;">

private string  getPostBackControlName()
{
 Control control = null;
 //first we will check the &quot;__EVENTTARGET&quot; because if post back made by       the controls
 //which used &quot;_doPostBack&quot; function also available in Request.Form collection.
 string ctrlname = Page.Request.Params[&quot;__EVENTTARGET&quot;];
 if (ctrlname != null &amp;&amp; ctrlname != String.Empty)
 {
 control = Page.FindControl(ctrlname);
 }
 // if __EVENTTARGET is null, the control is a button type and we need to
 // iterate over the form collection to find it
 else
 {
 string ctrlStr = String.Empty;
 Control c = null;
 foreach (string ctl in Page.Request.Form)
 {
 //handle ImageButton they having an additional &quot;quasi-property&quot; in their Id which identifies
 //mouse x and y coordinates
 if (ctl.EndsWith(&quot;.x&quot;) || ctl.EndsWith(&quot;.y&quot;))
 {
 ctrlStr = ctl.Substring(0, ctl.Length - 2);
 c = Page.FindControl(ctrlStr);
 }
 else
 {
 c = Page.FindControl(ctl);
 }
 if (c is System.Web.UI.WebControls.Button ||
 c is System.Web.UI.WebControls.ImageButton)
 {
 control = c;
 break;
 }
 }
 }
 return control.ID;
}

</pre></p>
<p>Happy Programming!!!</p>
<p>Cheers,</p>
<p>Raja</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ctrlshiftb.wordpress.com/379/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ctrlshiftb.wordpress.com/379/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ctrlshiftb.wordpress.com/379/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ctrlshiftb.wordpress.com/379/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ctrlshiftb.wordpress.com/379/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ctrlshiftb.wordpress.com/379/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ctrlshiftb.wordpress.com/379/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ctrlshiftb.wordpress.com/379/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ctrlshiftb.wordpress.com/379/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ctrlshiftb.wordpress.com/379/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ctrlshiftb.wordpress.com/379/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ctrlshiftb.wordpress.com/379/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ctrlshiftb.wordpress.com/379/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ctrlshiftb.wordpress.com/379/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ctrlshiftb.wordpress.com&amp;blog=6856134&amp;post=379&amp;subd=ctrlshiftb&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ctrlshiftb.wordpress.com/2010/04/15/getting-the-controlname-which-caused-postback/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/26dfe8b9667b6d2599d465f051fc3a1c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Raja</media:title>
		</media:content>
	</item>
		<item>
		<title>Getting column description in SQL Server 2005</title>
		<link>http://ctrlshiftb.wordpress.com/2010/04/15/getting-column-description-in-sql-server-2005/</link>
		<comments>http://ctrlshiftb.wordpress.com/2010/04/15/getting-column-description-in-sql-server-2005/#comments</comments>
		<pubDate>Thu, 15 Apr 2010 16:31:50 +0000</pubDate>
		<dc:creator>Raja</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server 2005]]></category>

		<guid isPermaLink="false">http://ctrlshiftb.wordpress.com/?p=376</guid>
		<description><![CDATA[We are working on code generation and thought it would be neat to pull information from description (where we intend to put validations for ex. DOB &#8211; No future date).  The following query did that trick. Hope this helps someone. Happy Programming!!! Cheers, Raja<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ctrlshiftb.wordpress.com&amp;blog=6856134&amp;post=376&amp;subd=ctrlshiftb&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>We are working on code generation and thought it would be neat to pull information from description (where we intend to put validations for ex. DOB &#8211; No future date).  The following query did that trick.</p>
<p><pre class="brush: sql;">

SELECT
 [Table Name] = i_s.TABLE_NAME,
 [Column Name] = i_s.COLUMN_NAME,
 [Description] = s.value
FROM
 INFORMATION_SCHEMA.COLUMNS i_s
LEFT OUTER JOIN
 sys.extended_properties s
ON
 s.major_id = OBJECT_ID(i_s.TABLE_SCHEMA+'.'+i_s.TABLE_NAME)
 AND s.minor_id = i_s.ORDINAL_POSITION
 AND s.name = 'MS_Description'
WHERE
 OBJECTPROPERTY(OBJECT_ID(i_s.TABLE_SCHEMA+'.'+i_s.TABLE_NAME), 'IsMsShipped')=0
 --AND i_s.TABLE_NAME = 'table_name'
ORDER BY
 i_s.TABLE_NAME, i_s.ORDINAL_POSITION

</pre></p>
<p>Hope this helps someone.</p>
<p>Happy Programming!!!</p>
<p>Cheers,</p>
<p>Raja</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ctrlshiftb.wordpress.com/376/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ctrlshiftb.wordpress.com/376/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ctrlshiftb.wordpress.com/376/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ctrlshiftb.wordpress.com/376/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ctrlshiftb.wordpress.com/376/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ctrlshiftb.wordpress.com/376/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ctrlshiftb.wordpress.com/376/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ctrlshiftb.wordpress.com/376/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ctrlshiftb.wordpress.com/376/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ctrlshiftb.wordpress.com/376/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ctrlshiftb.wordpress.com/376/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ctrlshiftb.wordpress.com/376/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ctrlshiftb.wordpress.com/376/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ctrlshiftb.wordpress.com/376/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ctrlshiftb.wordpress.com&amp;blog=6856134&amp;post=376&amp;subd=ctrlshiftb&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ctrlshiftb.wordpress.com/2010/04/15/getting-column-description-in-sql-server-2005/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/26dfe8b9667b6d2599d465f051fc3a1c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Raja</media:title>
		</media:content>
	</item>
		<item>
		<title>3.14</title>
		<link>http://ctrlshiftb.wordpress.com/2010/03/14/3-14/</link>
		<comments>http://ctrlshiftb.wordpress.com/2010/03/14/3-14/#comments</comments>
		<pubDate>Sun, 14 Mar 2010 16:32:52 +0000</pubDate>
		<dc:creator>Ron</dc:creator>
				<category><![CDATA[Miscellaneous]]></category>
		<category><![CDATA[Random]]></category>

		<guid isPermaLink="false">http://ctrlshiftb.wordpress.com/2010/03/14/3-14/</guid>
		<description><![CDATA[Happy PI day! ~Ron<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ctrlshiftb.wordpress.com&amp;blog=6856134&amp;post=372&amp;subd=ctrlshiftb&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Happy PI day!</p>
<p>~<strong>Ron</strong></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ctrlshiftb.wordpress.com/372/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ctrlshiftb.wordpress.com/372/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ctrlshiftb.wordpress.com/372/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ctrlshiftb.wordpress.com/372/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ctrlshiftb.wordpress.com/372/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ctrlshiftb.wordpress.com/372/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ctrlshiftb.wordpress.com/372/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ctrlshiftb.wordpress.com/372/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ctrlshiftb.wordpress.com/372/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ctrlshiftb.wordpress.com/372/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ctrlshiftb.wordpress.com/372/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ctrlshiftb.wordpress.com/372/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ctrlshiftb.wordpress.com/372/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ctrlshiftb.wordpress.com/372/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ctrlshiftb.wordpress.com&amp;blog=6856134&amp;post=372&amp;subd=ctrlshiftb&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ctrlshiftb.wordpress.com/2010/03/14/3-14/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c6a2612be610d0db88d98f1c5f6aa528?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">caranthir</media:title>
		</media:content>
	</item>
	</channel>
</rss>
