<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Aaron Lowe &#187; VSDBPro</title>
	<atom:link href="http://www.aaronlowe.net/archive/category/vsdbpro/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.aaronlowe.net</link>
	<description>SELECT my.Thoughts FROM Vendoran.dbo.Brain my</description>
	<lastBuildDate>Mon, 30 Jan 2012 19:00:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>SQLPASS Conference Day 2</title>
		<link>http://www.aaronlowe.net/archive/2011/10/sqlpass-conference-day-2/</link>
		<comments>http://www.aaronlowe.net/archive/2011/10/sqlpass-conference-day-2/#comments</comments>
		<pubDate>Fri, 14 Oct 2011 13:00:04 +0000</pubDate>
		<dc:creator>Vendoran</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[VSDBPro]]></category>
		<category><![CDATA[sqlpass]]></category>

		<guid isPermaLink="false">http://www.aaronlowe.net/?p=304</guid>
		<description><![CDATA[Today started out with a keynote from Quentin Clark and he talked about what he termed the “Fantastic 12 of 2012” reasons : Required 9&#8242;s &#38; Protection &#8211; Integration Services is now Integration Server; HA for StreamInsight; AlwaysOn Blazing-Fast Performance – Column Store Indexes; improvements across the board Rapid Data Exploration – Power View + [...]]]></description>
			<content:encoded><![CDATA[<p>Today started out with a keynote from Quentin Clark and he talked about what he termed the “Fantastic 12 of 2012” reasons :</p>
<ol>
<li>Required 9&#8242;s &amp; Protection &#8211; <em>Integration Services is now Integration Server; HA for StreamInsight; AlwaysOn</em></li>
<li>Blazing-Fast Performance – <em>Column Store Indexes; improvements across the board</em></li>
<li>Rapid Data Exploration – <em>Power View + PowerPivot; Admin from SharePoint; Reporting Alerts</em></li>
<li>Managed Self-Service BI – <em>same as #3</em></li>
<li>Credible Consistent Data – <em>BI Semantic Model (BISM); Data Quality Services (DQS);Master Data Services (MDS)</em></li>
<li>Organize Compliance – <em>Expanded Audit (user defined and filtering); User Defined Server Roles</em></li>
<li>Peace of Mind – <em>Production-simulated distributed testing; System Center Advisor &amp; Management Packs; Expanded Support – Premier Mission Critical</em></li>
<li>Scalable Data Warehouse – <em>SQL Server Appliances; HW + SW + Support – Just add Power; choice of hardware</em></li>
<li>Fast Time to Solution – <em>Same as #8</em></li>
<li>Extend Any Data, Anywhere – <em>Greater Interoperability, New Drivers for PHP, Java and Hadoop; ODBC Drivers for Linux &amp; CDC for SSIS and Oracle; Beyond Relational: FileTable, 2D Spatial, Semantic Search</em></li>
<li>Optimized Productivity – <em>SQL Server Data Tools (SSDT); Unified Across Database &amp; BI; Database &amp; Targeting Freedom</em></li>
<li>Scale on Demand – <em>AlwaysOn; Deployment across Public &amp; Private; Elastic Scale</em></li>
</ol>
<p>We saw demos of AlwaysOn, Column Store Index, Data Quality, and Semantic Search, plus they showed off the SQL Server Appliances.  The thing that really stood out to me in the keynote was the Semantic Search Demo.  The presenter took two pdf files and utilizing TSQL was able to relate them conceptually.  Looked very cool, you can go <a href="http://msdn.microsoft.com/en-us/library/gg492075(SQL.110).aspx" target="_blank">here</a> for more info.</p>
<p>After that I attended Matt Masson’s (<a href="http://twitter.com/#!/mattmasson" target="_blank">twitter</a> | <a href="http://blogs.msdn.com/b/mattm/" target="_blank">blog</a>) session on Top 10 Things You Didn’t Know About SSIS in SQL Server Code Name &#8220;Denali&#8221;.  These were items that are post CTP3.  To kill some time while waiting for the session to start Matt went through a mock scenario of utilizing SSIS to create virtual friends to party with him and his cat (Mr. Wiggles) on Facebook using Facebook Services and StreamInsight Transform – it was absolutely hilarious!</p>
<ol>
<li>Change Data Capture – <em>as someone who has done <a href="http://www.aaronlowe.net/archive/2009/12/ssis-cdc-lsn-debugging-nightmare-introduction/" target="_blank">CDC in SSIS</a> this was very cool</em></li>
<li>ODBC Support</li>
<li>Connections Managers – <em>Shared In-Memory Cache Across Packages using the shared project level connection manager</em></li>
<li>Flat File Source Improvements – <em>supports varying number of columns and can parse embedded qualifiers</em></li>
<li>Package Format Changes – <em>doesn’t persist default values; doesn’t use lineage id’s, instead uses ref id’s; sorted by name</em></li>
<li>Visual Studio Configurations</li>
<li>Scripting Improvements – <em>can now set a break point in a script task/component and see data</em></li>
<li>Troubleshooting &amp; Logging – <em>Built-in reporting; Component Timing &amp; Row Counts; Server level logging</em></li>
<li>Data Taps – <em>can write out data to a csv location without code change (doesn’t log binary)</em></li>
<li>Server Management using PowerShell</li>
<li>Honorable Mention – <em>Project <a href="http://projectbarcelona.cloudapp.net/" target="_blank">Barcelona</a> Metadata Discovery – crawler that crawls entire MS stack to determine Impact Analysis and Data Lineage</em></li>
</ol>
<p>These were on top of all the other things we new about for SSIS in SQL 2012, and I have to say that I’m really looking forward to it!</p>
<p>Next I went to the Lighting Talks which is a cool idea.  The premise is to have a number of speakers, this one has seven.  Each speaker however is limited to 5 minutes and there is someone utilizing a timer and the crowd is encouraged to clap people off stage that go to long.  It was a lot of fun.  The two that really stood above the rest (in my opinion anyway) were Grant Fritchey’s (<a href="http://twitter.com/#!/gfritchey" target="_blank">twitter</a> | <a href="http://www.scarydba.com/" target="_blank">blog</a>) “Backup Testing, The Rant ” and Niko Neugebauer’s (<a href="http://twitter.com/#!/NikoNeugebauer" target="_blank">twitter</a> | <a href="http://www.sqlport.com/sql-server/" target="_blank">blog</a>) “Build Up”.</p>
<p>Last was Database Development with SQL Server Data Tools Code-Named “Project Juneau” by Gert Drapers (<a href="http://blogs.msdn.com/b/gertd/" target="_blank">blog</a>).  As someone who has used Database Professional <a href="http://www.aaronlowe.net/archive/category/vsdbpro/" target="_blank">extensively</a>, I was pretty skeptical going in since in that Unit Tests aren’t in SSDT.  As you would expect one of the big features is that it has support for Azure.  However some of the stuff that I did see was really cool:</p>
<ul>
<li>A True Debugger with break points and a Call Stack, with the ability to start in the .NET app</li>
<li>Refactor can now reach into the application</li>
<li>True Language Services – can right click to go to reference, etc.</li>
<li>Drift Detection – if working in a connected stated it will poll database to see if any changes happened behind you and you can just drag and drop changes into project</li>
<li>Easier way to save specific deployed versions</li>
<li>Table designer where you see both code and the designer window</li>
<li>SQL CLR is within the same project, no longer have to create a separate CLR project</li>
</ul>
<p>Some things I still have to think if I like or not:</p>
<ul>
<li>Renamed Deploy to publish so that Projects are now Published</li>
<li>Multiple objects are now in a single file, for example the indexes, keys are now defined in the create table script file</li>
</ul>
<p>And the things I don’t like, until vNext Visual Studio + 3 months we’re missing:</p>
<ul>
<li>Data comparison</li>
<li>Data Generation</li>
<li>Unit Testing</li>
</ul>
<p>Now for the great news.  It’s completely <strong>FREE</strong>!!  It will be delivered as part of the SQL Server install <strong>as well as</strong> part of the Visual Studio install or you can get it through  the Web Platform Installer to get it!  We’ve come a long way from requiring TFS 2005 Team System.  Looks like we are getting closer to a standard SQL Server development environment.  That was it for day 2, next up is the 3rd and final day.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.aaronlowe.net/archive/2011/10/sqlpass-conference-day-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Database Project with CLR Project Dependency</title>
		<link>http://www.aaronlowe.net/archive/2010/08/database-project-with-clr-project-dependency/</link>
		<comments>http://www.aaronlowe.net/archive/2010/08/database-project-with-clr-project-dependency/#comments</comments>
		<pubDate>Fri, 20 Aug 2010 13:00:00 +0000</pubDate>
		<dc:creator>Vendoran</dc:creator>
				<category><![CDATA[VSDBPro]]></category>
		<category><![CDATA[clr]]></category>
		<category><![CDATA[deployment]]></category>

		<guid isPermaLink="false">http://www.aaronlowe.net/?p=260</guid>
		<description><![CDATA[Since I started blogging again, I haven’t done any technical posts yet and I figured it’s about time. I have been using Visual Studio Database Projects since DataDude beta’s came out in 2005.  A while ago, I was tasked with a database project that had a CLR dependency and working through the dependency.  Here’s how [...]]]></description>
			<content:encoded><![CDATA[<p>Since I started blogging <a href="http://www.aaronlowe.net/archive/2010/07/allow-me-to-reintroduce-myself/" target="_blank">again</a>, I haven’t done any technical posts yet and I figured it’s about time.</p>
<p>I have been using Visual Studio Database Projects since DataDude beta’s came out in 2005.  A while ago, I was tasked with a database project that had a CLR dependency and working through the dependency.  Here’s how to have a database project that depends on a CLR project and works for Deployment. </p>
<p>Let’s create a simple Database Project with just 1 table for Customers.  In the Customer table  we’ll store an email that will have a constraint for proper email format written in CLR.  We’ll also build the dependency between the projects and configure proper deployment.</p>
<p>So first we need to create the Database Project called CLRDependency:</p>
<p><a href="http://www.aaronlowe.net/wp-content/uploads/2010/08/ProjectName1.png"><img style="display: inline; margin-left: 0px; margin-right: 0px; border: 0px;" title="ProjectName" src="http://www.aaronlowe.net/wp-content/uploads/2010/08/ProjectName_thumb1.png" border="0" alt="ProjectName" width="444" height="285" /></a></p>
<p>And a simple Customers table:</p>
<pre class="brush: sql;">CREATE TABLE [dbo].[Customers]
(
    pkCustomerID int NOT NULL IDENTITY(1,1),
    FirstName varchar(25) NULL,
    LastName varchar(25) NOT NULL,
    EmailAddress varchar(50) NOT NULL
);</pre>
<p>Next let’s add a new CLR project called CLRFunctions:</p>
<p><a href="http://www.aaronlowe.net/wp-content/uploads/2010/08/CLRFunctions1.png"><img style="display: inline; margin-left: 0px; margin-right: 0px; border: 0px;" title="CLRFunctions" src="http://www.aaronlowe.net/wp-content/uploads/2010/08/CLRFunctions_thumb1.png" border="0" alt="CLRFunctions" width="432" height="290" /></a></p>
<p>When creating this, it will ask for a database to reference.  Since we haven’t created the database yet you can just click Cancel.  Next Create a UserDefinedFunction called ValidateEmailAddress.cs with the following code:</p>
<pre class="brush: csharp;">using System;
using System.Data;
using System.Data.SqlClient;
using System.Data.SqlTypes;
using Microsoft.SqlServer.Server;
using System.Text.RegularExpressions;

public partial class UserDefinedFunctions
{
    [Microsoft.SqlServer.Server.SqlFunction]
    public static SqlBoolean ValidateEmailAddress(SqlString emailAddress)
    {

        return new SqlBoolean(Regex.IsMatch(emailAddress.Value, @"^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$"));
    }
};</pre>
<p>In Solution Explorer, Right-click on References in the database project and click on Add Reference, then select the project :</p>
<p><a href="http://www.aaronlowe.net/wp-content/uploads/2010/08/ProjectReference.png"><img style="display: inline; border-width: 0px;" title="ProjectReference" src="http://www.aaronlowe.net/wp-content/uploads/2010/08/ProjectReference_thumb.png" border="0" alt="ProjectReference" width="235" height="244" /></a> <a href="http://www.aaronlowe.net/wp-content/uploads/2010/08/Reference.png"><img style="display: inline; border-width: 0px;" title="Reference" src="http://www.aaronlowe.net/wp-content/uploads/2010/08/Reference_thumb.png" border="0" alt="Reference" width="244" height="102" /></a> <a href="http://www.aaronlowe.net/wp-content/uploads/2010/08/ProjectDependency.png"><img style="display: inline; border-width: 0px;" title="ProjectDependency" src="http://www.aaronlowe.net/wp-content/uploads/2010/08/ProjectDependency_thumb.png" border="0" alt="ProjectDependency" width="244" height="198" /></a></p>
<p>You’ll see CLRFunctions appear under References:</p>
<p><a href="http://www.aaronlowe.net/wp-content/uploads/2010/08/CLRDependency.png"><img style="display: inline; margin-left: 0px; margin-right: 0px; border-width: 0px;" title="CLRDependency" src="http://www.aaronlowe.net/wp-content/uploads/2010/08/CLRDependency_thumb.png" border="0" alt="CLRDependency" width="235" height="244" /></a></p>
<p>Now you only have to build the CLRFunctions Project and the Assembly will appear in your Database Schema View:</p>
<p><a href="http://www.aaronlowe.net/wp-content/uploads/2010/08/Schema.png"><img style="display: inline; margin-left: 0px; margin-right: 0px; border-width: 0px;" title="Schema" src="http://www.aaronlowe.net/wp-content/uploads/2010/08/Schema_thumb.png" border="0" alt="Schema" width="251" height="254" /></a> </p>
<p>Now we need to create the UserDefinedFunction in the Database Project so Right-Click on Functions and Add a Scalar Function:</p>
<pre class="brush: sql;">CREATE FUNCTION [dbo].[ValidateEmailAddress]
(
    @EmailAddress nvarchar(50)
)
RETURNS BIT
AS
    EXTERNAL NAME [CLRFunctions].[UserDefinedFunctions].[ValidateEmailAddress];</pre>
<p>Lastly let’s create the Check Constraint:</p>
<p> <a href="http://www.aaronlowe.net/wp-content/uploads/2010/08/CheckConstraint.png"><img style="display: inline; margin-left: 0px; margin-right: 0px; border-width: 0px;" title="CheckConstraint" src="http://www.aaronlowe.net/wp-content/uploads/2010/08/CheckConstraint_thumb.png" border="0" alt="CheckConstraint" width="244" height="225" /></a></p>
<pre class="brush: sql;">ALTER TABLE [dbo].[Customers]
    ADD CONSTRAINT [CK_ValidateEmailAddress]
    CHECK  ([dbo].[ValidateEmailAddress](EmailAddress) = 1);</pre>
<p>So now we have the two projects working together and everything is great.  However if you build it, you’ll see this:</p>
<pre>------ Build started: Project: CLRFunctions, Configuration: Debug Any CPU ------
  CLRFunctions -&gt; C:\AMLProjs\Local\CLRDependency\CLRFunctions\bin\Debug\CLRFunctions.dll
------ Build started: Project: CLRDependency, Configuration: Debug Any CPU ------
  CLRDependency -&gt; C:\AMLProjs\Local\CLRDependency\CLRDependency\sql\debug\CLRDependency.dbschema
------ Deploy started: Project: CLRFunctions, Configuration: Debug Any CPU ------
Error: Cannot deploy. There is no database connection specified. To correct this error, add a database connection using the project properties.
------ Deploy started: Project: CLRDependency, Configuration: Debug Any CPU ------
    Deployment script generated to:
C:\AMLProjs\Local\CLRDependency\CLRDependency\sql\debug\CLRDependency.sql 

    The deployment script was generated, but was not deployed. You can change the deploy action on the Deploy tab of the project properties.
========== Build: 2 succeeded or up-to-date, 0 failed, 0 skipped ==========
========== Deploy: 1 succeeded, 1 failed, 0 skipped ==========</pre>
<p>That’s not good, we have a failure.  However this is easily solved.  Just uncheck the deployment option on the CLR Project in the solution properties:</p>
<p><a href="http://www.aaronlowe.net/wp-content/uploads/2010/08/DontDeployProperties1.png"><img style="display: inline; border: 0px;" title="DontDeployProperties" src="http://www.aaronlowe.net/wp-content/uploads/2010/08/DontDeployProperties_thumb1.png" border="0" alt="DontDeployProperties" width="376" height="270" /></a></p>
<p>And now when you deploy you will see:</p>
<pre>------ Build started: Project: CLRFunctions, Configuration: Debug Any CPU ------
  CLRFunctions -&gt; C:\AMLProjs\Local\CLRDependency\CLRFunctions\bin\Debug\CLRFunctions.dll
------ Build started: Project: CLRDependency, Configuration: Debug Any CPU ------
    Loading project references...
    Loading project files...
    Building the project model and resolving object interdependencies...
    Validating the project model...
    Writing model to CLRDependency.dbschema...
  CLRDependency -&gt; C:\AMLProjs\Local\CLRDependency\CLRDependency\sql\debug\CLRDependency.dbschema
------ Skipped Deploy: Project: CLRFunctions, Configuration: Debug Any CPU ------
Project not selected to build for this solution configuration
------ Deploy started: Project: CLRDependency, Configuration: Debug Any CPU ------
    Deployment script generated to:
C:\AMLProjs\Local\CLRDependency\CLRDependency\sql\debug\CLRDependency.sql

    Creating CLRDependency...
    Creating [CLRFunctions]...
    Creating [dbo].[Customers]...
    Creating [dbo].[ValidateEmailAddress]...
    Creating CK_ValidateEmailAddress...
    Checking existing data against newly created constraints
========== Build: 2 succeeded or up-to-date, 0 failed, 0 skipped ==========
========== Deploy: 1 succeeded, 0 failed, 1 skipped ==========</pre>
<p>Something to remember is that you can actually deploy this to a server that does not have CLR Enabled, however when you go to insert anything into that table, it will fail with this error: </p>
<pre>Msg 6263, Level 16, State 1, Line 1
Execution of user code in the .NET Framework is disabled. Enable "clr enabled" configuration option.</pre>
<p>So make sure you enable CLR on the Server.  Now onto testing (you do <a href="http://www.aaronlowe.net/archive/2010/07/dont-worry-ill-get-to-it/" target="_blank">test</a> your work right?)</p>
<pre class="brush: sql;">USE CLRDependency;
GO
INSERT INTO dbo.Customers
    (FirstName, LastName, EmailAddress)
VALUES
    ('Aaron', 'Lowe', 'AaronL@AaronLowe.net');
GO
INSERT INTO dbo.Customers
    (FirstName, LastName, EmailAddress)
VALUES
    ('Aaron', 'Lowe', 'boo');
GO</pre>
<p>Results as expected:</p>
<pre>(1 row(s) affected)
Msg 547, Level 16, State 0, Line 1
The INSERT statement conflicted with the CHECK constraint "CK_ValidateEmailAddress". The conflict occurred in database "CLRDependency", table "dbo.Customers", column 'EmailAddress'.
The statement has been terminated.</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.aaronlowe.net/archive/2010/08/database-project-with-clr-project-dependency/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Don’t Worry, I’ll Get To It</title>
		<link>http://www.aaronlowe.net/archive/2010/07/dont-worry-ill-get-to-it/</link>
		<comments>http://www.aaronlowe.net/archive/2010/07/dont-worry-ill-get-to-it/#comments</comments>
		<pubDate>Fri, 23 Jul 2010 13:00:00 +0000</pubDate>
		<dc:creator>Vendoran</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[Professional Development]]></category>
		<category><![CDATA[VSDBPro]]></category>

		<guid isPermaLink="false">http://www.aaronlowe.net/archive/2010/07/dont-worry-ill-get-to-it/</guid>
		<description><![CDATA[Looking back you realized where you made your first mistake.  You thought it would work out differently; in fact, you knew it would.  Alas, you believed the lie. Wait, let’s back up: Sweat mars your brow as you start to feel panic set in.  You reach for your mountain dew can and quickly put it [...]]]></description>
			<content:encoded><![CDATA[<p>Looking back you realized where you made your first mistake.  You thought it would work out differently; in fact, you knew it would.  Alas, you believed the lie.</p>
<p><em>Wait, let’s back up:</em></p>
<p>Sweat mars your brow as you start to feel panic set in.  You reach for your mountain dew can and quickly put it down so no one will see your hand shaking (plus don’t want to spill a good dew).</p>
<p><em>Still need to back up further:</em></p>
<p>You were minding your own business watching a great <a href="http://www.sqlpass.org/">SQLPASS</a> webcast and thinking of how you were going to implement those cool things you learned.  At least, that was until you got <a href="http://www.youtube.com/watch?v=Hj-qhIGTXdU">THE PHONECALL</a>.  Your boss calls and says, “Hey there’s this project going on that is going to need some database help, I’ve told them you’re just the person to do it.  So I’ve scheduled you in a conference call tomorrow morning first thing.  Sounded pretty straight forward so should be no problem.” You then start downloading your brain to notepad and internet links so you don’t forget the <a href="http://www.sqlpass.org/">SQLPASS</a> presentation.</p>
<p>You come in the next day, get your morning Mountain Dew (hey it’s my story and I’m not much of a coffee drinker) and jump on the conference call.    That is when you hear this:</p>
<p>“Glad you could join us; your boss said you were the best, so we’re expecting great things from you.  What we need is a database to store the Excel documents we’ve been working on for the past year.  We’ve just been emailing them around, so we’ll need to import the data and be able to create reports.  I already spec’d it out in Access and don’t think it should take more than a week, but with you on here, it should take less time!  This is good because we’re already committed to deadlines in about a month. I will email you the Excel documents, once you look and understand them we will talk later this afternoon to answer any questions you have. K, thanks, bye”</p>
<p>You start seeing visions of SSIS, SSRS and SQL go through your head and you’re wrapping your brain around everything that needs to be done, when you get the email: “Here’s a couple of the first type of spreadsheets, there are actually 3 different types of spreadsheets but it’s all related.  Should be no problem for a wiz like you, huh? <img src='http://www.aaronlowe.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  When you’re ready for the rest, let us know and we can create a CD of them – think there’s about 300 or so.  I forgot to mention on the call that while we have a deadline in a month, we promised to start getting reports out next week, so I’m really looking forward to seeing the reports this week.”</p>
<p>Sweat mars your brow as you start to feel panic set in.  You reach for your mountain dew can and quickly put it down so no one will see your hand shaking (plus don’t want to spill a good dew).   Then a thought creeps into your head, you initially reject it, and look around to make sure no one heard it, but as you think about it, the thought starts making sense and you start to smile.  You now have the way to meet or possibly exceed the expectations and you can look like the hero.  So you say to yourself, “Don’t worry, I’ll just import manually, create the code as I go to be quick, then I can go back and clean it up later”</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</p>
<p>The above scenario is not that uncommon in our field.  We are brought in as the experts and expected to produce things quickly.  The business group does not know and possibly does not even care about everything we do. But, really, it is not their job, if they did, you would not have one.  Things like code quality, code coverage, and security are your job, not theirs.</p>
<p>However, I am still seeing too many people try to be the hero by working around the clock or reducing code quality to meet the requirements as soon as possible.  Let me refute some more common reasons:</p>
<p><strong>I will have plenty of time…</strong></p>
<p>The idea that you will all of a sudden have this huge amount of free time to do performance improvements, proper error handling, better naming conventions, etc. is a myth.  More likely, you will be pulled onto another project and then someone will knock on your door in a year or two asking you to explain this really bad code they found.  If on the other hand you are experiencing large blocks of free time, please send me a note as I might have some work for you.  <em>Companies pay you to work, which is the opposite of having free time.</em></p>
<p><strong>I’ll just do it this once…</strong></p>
<p>If you put that kind of code out there, you will probably end up doing a lot of manual process/manipulation.  This means when it is time to actually go-live, you scramble to get it all working, again reducing quality.  I have often seen “While it’s in development I don’t have to worry about getting it scheduled.  Oh that process didn’t work; I’ll just manually fix it.”  <em>If you have to fix it manually in development, you will have to fix it manually in prod.</em></p>
<p><strong>They just don’t understand</strong></p>
<p>Our job should not just be seen as a cost center it should be seen as an asset.  That does not mean we just produce great code/functionality, it means we help the business achieve the business goals.  In other words, we work “with” not “for” the business.</p>
<p>Back in the Exchange 5.5 days, I did some work as a systems administrator.  We discovered that some people were using mailboxes that had up to 500 MB in them, while the average was around 100; I researched best practices and did all this analysis.  I finally brought the suggestion to my boss, “We should limit everyone’s mailbox to XX size that way we don’t have space issues” His response “This is obviously the way our people work and if it is, why we shouldn’t just invest in more space so they can continue to work that way?”</p>
<p>I had never considered the business, only the technology.  When you just have technology on the brain and not the business or the people you come up with solutions for the technology. “My system would be perfect except for all those users”</p>
<p>Take the time to explain what you <em>need </em>to accomplish so you can create what they <em>want </em>you to accomplish.  They want it sooner rather than later? Then reflect some of those decisions back to them, even empowering them to make some.  “Yes I can get that really cool function out there this week, but everyone in the world will have access to it,  With a couple more days I can also have it secure.  Which would you like?”  Of course, this means that you have to think more strategically about the project, which can be difficult at times.  We all know how easy (and fun) it is to just jump in there and start producing code”.  <em>Transparency is the key.</em></p>
<p><strong>But I’m always having to change things</strong></p>
<p>Realize that some refactoring will always be necessary. The days of going away for 6 months to create something and come back to do your big “<a href="http://www.youtube.com/watch?v=XBrz7zMg91k">ta-da</a>” are long gone.  People want things faster with more agility so things can change as we go along.    This means more pressure to produce faster, which means refactoring and adding additional functionality as you go.  However every line of code you write should be quality.  I don’t know how many times I have seen Proof-of-Concepts (POCs) turn into the actual production system.  Just because it is a POC from a business perspective does not mean that it should be a POC from a code quality perspective.  I actually saw someone code up a textbook T-SQL injection (put the stored procedure parameter straight in the where clause without any validation), with the intention of fixing it later.  <em>If it is wrong to do later, it is wrong to do now.</em></p>
<p>In the development world, there are many tools for code coverage, unit testing, refactoring, etc.  While there are some tools out there like <a href="http://www.microsoft.com/visualstudio/en-us">VSDBPro</a> unit testing, <a href="http://www.dbproj.com/">VSDBPro</a> and <a href="http://www.red-gate.com/">Red Gate</a> refactoring, etc., the tools in the database world are not as mature.  There is no IDE that forces white space or automatically documents for you.  We do not have tools where we can just do a few clicks and have end-to-end tests.</p>
<p>However, that is no excuse to be a gunslinger and just shoot from the hip.  We are professionals and should be creating professional code that is readable, documented and have a standard of quality.</p>
<p>If you are struggling with that, adopt a <a href="http://www.sqlservercentral.com/articles/Testing/66553/">Test Driven Development</a> (TDD) philosophy or something else that will force you to think about or do things better.</p>
<p>Or maybe it is taking you 5 minutes to figure out what is going on in a stored procedure you just wrote a couple days ago.  If so, let’s be honest you failed in either code readability and/or documentation. No excuses, there are even <a href="http://www.wangz.net/pp/sqlformat.htm">good free tools</a> out there. Whitespaceisreallyagoodthing.</p>
<p><strong>Code Quality, Code Readability and Code Documentation is Important</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.aaronlowe.net/archive/2010/07/dont-worry-ill-get-to-it/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>VSDBPro Permissions part 2</title>
		<link>http://www.aaronlowe.net/archive/2009/10/vsdbpro-permissions-part-2/</link>
		<comments>http://www.aaronlowe.net/archive/2009/10/vsdbpro-permissions-part-2/#comments</comments>
		<pubDate>Mon, 12 Oct 2009 09:00:00 +0000</pubDate>
		<dc:creator>Vendoran</dc:creator>
				<category><![CDATA[VSDBPro]]></category>

		<guid isPermaLink="false">/post/2009/10/12/VSDBPro-Permissions-part-2.aspx</guid>
		<description><![CDATA[So now that we have the login and the user set up, how do we actually assign permissions?&#160; I prefer to assign permissions to roles and add users to roles which mirrors the user/groups of windows, so going down that path we have to create a role (going under Security &#8211;&#62; Roles): CREATE ROLE [TestRole] [...]]]></description>
			<content:encoded><![CDATA[<p>So now that we have the login and the user set up, how do we actually assign permissions?&nbsp;</p>
<p>I prefer to assign permissions to roles and add users to roles which mirrors the user/groups of windows, so going down that path we have to create a role (going under Security &ndash;&gt; Roles):</p>
<pre class="brush: sql;">CREATE ROLE [TestRole]</pre>
<p>Now comes the part that isn&rsquo;t very intuitive.&nbsp; To associate a user with a role you have to go back to the Solution Explorer and actually create a generic user script file (see <a href="http://social.msdn.microsoft.com/Forums/en-US/vstsdb/thread/2ced1565-8d7a-4ee9-ba77-45fb8c650faa/" target="_blank">here</a>), you can call it whatever you want and place it wherever you want in the project, however if you reverse engineer the database it will be called &lt;ProjectName&gt;.rolememberships.sql under the schema objects folder:</p>
<pre class="brush: sql;">EXECUTE sp_addrolemember @rolename = N'TestRole', @membername = N'TestUser';</pre>
<p>Now we have the role defined and the users as part of the role, we can start adding permissions, this is where you&rsquo;ll have loads of fun provided you enjoy manually editing xml documents.&nbsp; Again in Solution Explorer under Properties you&rsquo;ll see a Database.sqlpermissions.sql file:</p>
<p><a href="http://www.flickr.com/photos/vendoran/3988936366/"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Properties" src="http://www.aaronlowe.net/wp-content/uploads/Properties.png" border="0" alt="Properties" width="244" height="185" /></a></p>
<p>In there you&rsquo;ll see some xml with examples:</p>
<pre class="brush: xml;">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;?XML:NAMESPACE PREFIX = [default] urn:Microsoft.VisualStudio.Data.Schema.Permissions NS = "urn:Microsoft.VisualStudio.Data.Schema.Permissions" /&gt;
  <!--  The examples below are provided to illustrate how permissions
        are defined in the project system for Databases, Objects,
        and Columns.

        GRANT Database Permissions

        <PermissionStatement Action ="GRANT">
          <Permission>CREATE TABLE</Permission>
          <Grantee>User1</Grantee>
        </PermissionStatement>

        GRANT Object Permission

        <PermissionStatement Action ="GRANT">
          <Permission>SELECT</Permission>
          <Grantee>User1</Grantee>
          <Object Name ="Table1" Schema ="User1" Type ="OBJECT" />
        </PermissionStatement>

        DENY Object Permission

        <PermissionStatement Action ="DENY">
          <Permission>DELETE</Permission>
          <Grantee>User1</Grantee>
          <Object Name ="Table1" Schema ="User1" Type ="OBJECT" />
        </PermissionStatement>

        GRANT Object Column Permission

        <PermissionStatement Action ="GRANT">
          <Permission>SELECT</Permission>
          <Grantee>User1</Grantee>
          <Object Name ="Table1" Schema ="User1" Type ="OBJECT">
            <Columns Treatment ="INCLUDE">
              <Column Name=&rdquo;Col1&rdquo; />
              <Column Name=&rdquo;Col2&rdquo; />
              <Column Name=&rdquo;&hellip;&rdquo; />
            </Columns>
          </Object>
        </PermissionStatement>
  -->
</pre>
<p>So as you can see while it&rsquo;s not that intuitive it is pretty straight forward.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.aaronlowe.net/archive/2009/10/vsdbpro-permissions-part-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>VSDBPro Permissions part 1, Logins and Users</title>
		<link>http://www.aaronlowe.net/archive/2009/10/vsdbpro-permissions-part-1-logins-and-users/</link>
		<comments>http://www.aaronlowe.net/archive/2009/10/vsdbpro-permissions-part-1-logins-and-users/#comments</comments>
		<pubDate>Thu, 08 Oct 2009 07:00:00 +0000</pubDate>
		<dc:creator>Vendoran</dc:creator>
				<category><![CDATA[VSDBPro]]></category>

		<guid isPermaLink="false">/post/2009/10/08/VSDBPro-Permissions-part-1-Logins-and-Users.aspx</guid>
		<description><![CDATA[So how do we manage permissions in a Database Project?&#160; Well the logins and users are pretty straight forward, however sadly the grants are not as intuitive as we&#8217;d like (unless you find manually editing xml documents intuitive), but the next version is supposed to be gui driven.&#160; However right now I hope you enjoy [...]]]></description>
			<content:encoded><![CDATA[<p>So how do we manage permissions in a Database Project?&nbsp; Well the logins and users are pretty straight forward, however sadly the grants are not as intuitive as we&rsquo;d like (unless you find manually editing xml documents intuitive), but the next version is supposed to be gui driven.&nbsp; However right now I hope you enjoy editing xml.</p>
<p>So first we take the Server project and create the login for the user (if don&rsquo;t know the difference between Logins and Users go read <a href="http://twitter.com/kbriankelley" target="_blank">K. Brian Kelley&rsquo;s</a> post <a href="http://www.sqlservercentral.com/blogs/brian_kelley/archive/2009/04/21/sql-server-security-basics-logins-vs-users.aspx" target="_blank">here</a>, I&rsquo;ll wait).&nbsp; If you are in Schema view (and if not, why <a href="http://www.aaronlowe.net/post/2009/10/06/VSDBPro-e28093-multiple-schemas.aspx" target="_blank">not</a>?) make sure to go under Server Level Objects &ndash;&gt; Security &ndash;&gt; Logins, not the Security &ndash;&gt; Users path, as you want a Server Login, not a master db User<a href="http://www.flickr.com/photos/vendoran/3988065071/"><img style="border-bottom: 0px; border-left: 0px; display: inline; margin-left: 0px; border-top: 0px; margin-right: 0px; border-right: 0px" title="Logins" src="http://www.aaronlowe.net/wp-content/uploads/Logins_1.png" border="0" alt="Logins" width="138" height="244" align="right" /></a>.</p>
<p>You&rsquo;ll also notice in the Add new item dialog that there is a different template for each:</p>
<ul>
<li>Login (Windows Auth) </li>
<li>Login (Sql Server) </li>
</ul>
<p>At this point you might also be tempted in creation of the login to assign a default database, avoid that temptation.&nbsp; When you assign a default database, that user database must already exist, however when you deploy the server project (i.e., the master database) there&rsquo;s a good chance the user database won&rsquo;t exist yet, I promise we&rsquo;ll take care of it later though.</p>
<pre class="brush: sql;" style="width: 90%; height: 47px;">CREATE LOGIN TestLogin WITH PASSWORD = 'P@ssw0rd1'</pre>
<p>So now that you have a server login in the server project we need to create a database user (remember to <a href="http://www.aaronlowe.net/post/2009/10/02/VSDBPro-project-dependency.aspx" target="_blank">reference</a> the server project in the database project).&nbsp; This time you can go under the Security &ndash;&gt; Users path.</p>
<pre class="brush: sql;" style="width: 89.8%; height: 66px;">CREATE USER [TestUser]
    FOR LOGIN [TestLogin]
    WITH DEFAULT_SCHEMA = dbo;</pre>
<p>Now we have a login and a user created, lastly we set the default database in the database project post-Deployment script:</p>
<pre class="brush: sql;">ALTER LOGIN [TestLogin] WITH DEFAULT_DATABASE=[$(DatabaseName)]</pre>
<p>As you see I&rsquo;m using the variable of the database name since I can change the database name for each deployment:</p>
<p><a href="http://www.flickr.com/photos/vendoran/3988865332/"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="Deployment" src="http://www.aaronlowe.net/wp-content/uploads/Deployment.png" border="0" alt="Deployment" width="244" height="126" /></a></p>
<p>Taking a look at pertinent parts of the deployment sql scripts we have (remember this is in SQLCMD mode):</p>
<pre class="brush: sql;">/*
Deployment script for master -LocalServer.sql
*/
:setvar DatabaseName "master"
GO
USE [$(DatabaseName)]
GO
PRINT N'Creating TestLogin...';
GO
CREATE LOGIN [TestLogin]
    WITH PASSWORD = N'P@ssw0rd1', DEFAULT_DATABASE = master;
GO
------------------------------
/*
Deployment script for AdventureWorks - AdventureWorks.sql
*/
:setvar DatabaseName "AdventureWorks"
GO
CREATE USER [TestUser] FOR LOGIN [TestLogin];
GO
ALTER LOGIN [TestLogin] WITH DEFAULT_DATABASE=[$(DatabaseName)]
GO</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.aaronlowe.net/archive/2009/10/vsdbpro-permissions-part-1-logins-and-users/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

