<?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>Fri, 23 Jul 2010 13:00:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Don&#8217;t Worry, I&#8217;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>Aaron Lowe</dc:creator>
				<category><![CDATA[Database]]></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.&#160; You thought it would work out differently; in fact, you knew it would.&#160; Alas, you believed the lie. Wait, let’s back up: Sweat mars your brow as you start to feel panic set in.&#160; 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.&#160; You thought it would work out differently; in fact, you knew it would.&#160; Alas, you believed the lie. </p>
<p><i>Wait, let’s back up:</i></p>
<p>Sweat mars your brow as you start to feel panic set in.&#160; 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><i>Still need to back up further:</i></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.&#160; At least, that was until you got <a href="http://www.youtube.com/watch?v=Hj-qhIGTXdU">THE PHONECALL</a>.&#160; 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.&#160; So I’ve scheduled you in a conference call tomorrow morning first thing.&#160; 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.&#160;&#160;&#160; 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.&#160; What we need is a database to store the Excel documents we’ve been working on for the past year.&#160; We’ve just been emailing them around, so we’ll need to import the data and be able to create reports.&#160; 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!&#160; 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.&#160; 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.&#160; 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.&#160; 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).&#160;&#160; 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.&#160; You now have the way to meet or possibly exceed the expectations and you can look like the hero.&#160; 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.&#160; We are brought in as the experts and expected to produce things quickly.&#160; 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.&#160; 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.&#160; Let me refute some more common reasons: </p>
<p><b>I will have plenty of time…</b></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.&#160; 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.&#160; 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.&#160; <em>Companies pay you to work, which is the opposite of having free time.</em></p>
<p><b>I’ll just do it this once…</b></p>
<p>If you put that kind of code out there, you will probably end up doing a lot of manual process/manipulation.&#160; This means when it is time to actually go-live, you scramble to get it all working, again reducing quality.&#160; I have often seen “While it’s in development I don’t have to worry about getting it scheduled.&#160; Oh that process didn’t work; I’ll just manually fix it.”&#160; <em>If you have to fix it manually in development, you will have to fix it manually in prod.</em></p>
<p><b>They just don’t understand</b></p>
<p>Our job should not just be seen as a cost center it should be seen as an asset.&#160; That does not mean we just produce great code/functionality, it means we help the business achieve the business goals.&#160; In other words, we work “with” not “for” the business.&#160; </p>
<p>Back in the Exchange 5.5 days, I did some work as a systems administrator.&#160; 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.&#160; 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?”&#160; </p>
<p>I had never considered the business, only the technology.&#160; 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 <i>need </i>to accomplish so you can create what they <i>want </i>you to accomplish.&#160; They want it sooner rather than later? Then reflect some of those decisions back to them, even empowering them to make some.&#160; “Yes I can get that really cool function out there this week, but everyone in the world will have access to it,&#160; With a couple more days I can also have it secure.&#160; Which would you like?”&#160; Of course, this means that you have to think more strategically about the project, which can be difficult at times.&#160; We all know how easy (and fun) it is to just jump in there and start producing code”.&#160; <em>Transparency is the key.</em></p>
<p><b>But I’m always having to change things</b></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.&#160; People want things faster with more agility so things can change as we go along.&#160;&#160;&#160; This means more pressure to produce faster, which means refactoring and adding additional functionality as you go.&#160; However ever line of code you write should be quality.&#160; I don’t know how many times I have seen Proof-of-Concepts (POCs) turn into the actual production system.&#160; Just because it is a POC from a business perspective does not mean that it should be a POC from a code quality perspective.&#160; 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.&#160; <i>If it is wrong to do later, it is wrong to do now.</i></p>
<p>In the development world, there are many tools for code coverage, unit testing, refactoring, etc.&#160; 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.&#160; There is no IDE that forces white space or automatically documents for you.&#160; 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.&#160; 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.&#160; </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.&#160; 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><b>Code Quality, Code Readability and Code Documentation is Important</b></p>
]]></content:encoded>
			<wfw:commentRss>http://www.aaronlowe.net/archive/2010/07/dont-worry-ill-get-to-it/feed/</wfw:commentRss>
		<slash:comments>3</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>Aaron Lowe</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>Aaron Lowe</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>
		<item>
		<title>VSDBPro multiple schemas</title>
		<link>http://www.aaronlowe.net/archive/2009/10/vsdbpro-multiple-schemas/</link>
		<comments>http://www.aaronlowe.net/archive/2009/10/vsdbpro-multiple-schemas/#comments</comments>
		<pubDate>Tue, 06 Oct 2009 10:00:00 +0000</pubDate>
		<dc:creator>Aaron Lowe</dc:creator>
				<category><![CDATA[VSDBPro]]></category>

		<guid isPermaLink="false">/post/2009/10/06/VSDBPro-multiple-schemas.aspx</guid>
		<description><![CDATA[Lately I&#8217;ve been utilizing schemas more frequently in my databases, however the first time I did this in VSDBPro was a pain.&#160; The reason for this was I didn&#8217;t know how to do it, so hopefully this post will save someone else the struggles I went through. First I want to highlight the differences between [...]]]></description>
			<content:encoded><![CDATA[<p>Lately I&rsquo;ve been utilizing schemas more frequently in my databases, however the first time I did this in VSDBPro was a pain.&nbsp; The reason for this was I didn&rsquo;t know how to do it, so hopefully this post will save someone else the struggles I went through.</p>
<p>First I want to highlight the differences between Solution Explorer and Schema View.&nbsp; Solution Explorer is the physical file structure, it doesn&rsquo;t know about relationships other than the folder structure:<a href="http://www.flickr.com/photos/vendoran/3972494113/"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; margin-left: 0px; border-left-width: 0px; margin-right: 0px" title="SolutionExplorer[4]" src="http://www.aaronlowe.net/wp-content/uploads/SolutionExplorer%5B4%5D.png" border="0" alt="SolutionExplorer[4]" width="161" height="244" align="right" /></a></p>
<p>Then there is the schema view which does understand the relationships within the database and models very closely the Management Studio layout:</p>
<p><a href="http://www.flickr.com/photos/vendoran/3972496343/"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; margin-left: 0px; border-left-width: 0px; margin-right: 0px" title="SchemaView" src="http://www.aaronlowe.net/wp-content/uploads/SchemaView.png" border="0" alt="SchemaView" width="133" height="244" align="left" /></a></p>
<p>As you would imagine there are pros and cons to both.&nbsp; For example if you have invalid syntax for defining a table, you won&rsquo;t even see it in schema view, you&rsquo;ll only see it in solution explorer.&nbsp; However if you have a foreign key relationship that points to a missing column you&rsquo;ll see it in schema view with the warning symbol.&nbsp; Also the schema view has appropriate icons for different object types.</p>
<p>However back to the issue of schema management.&nbsp; I&rsquo;m very particular about naming conventions and file placement so not trusting the tool (sorry <a href="http://www.dbproj.com/" target="_blank">Gert</a>) I figured I new better and would just go into solution explorer and create the new schema myself.&nbsp; No problem: <a href="http://www.flickr.com/photos/vendoran/3972519793/"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; margin-left: 0px; border-left-width: 0px; margin-right: 0px" title="MySchema[5]" src="http://www.aaronlowe.net/wp-content/uploads/MySchema%5B5%5D.png" border="0" alt="MySchema[5]" width="191" height="244" align="right" /></a></p>
<p>And then I tried to create objects under that scheme however the folder structure wasn&rsquo;t there!!&nbsp; What a pain, so I went out to Windows Explorer copied the file structure from an existing schema, removing all the objects and added them into the project via Solution explorer, all the time wondering about the person who thought this was a good idea.</p>
<p>However lo and behold had I just switched over to schema view which understands what a schema is and what it can have, I would have been fine.<a href="http://www.flickr.com/photos/vendoran/3972526639/"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; margin-left: 0px; border-left-width: 0px; margin-right: 0px" title="MySchemaview" src="http://www.aaronlowe.net/wp-content/uploads/MySchemaview.png" border="0" alt="MySchemaview" width="244" height="238" /></a></p>
<p>What&rsquo;s more is that when I created my first table, it automatically not only created the table sql file, it created the entire folder structure, seen below back in solution explorer:</p>
<p><a href="http://www.flickr.com/photos/vendoran/3972538145/"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; margin-left: 0px; border-left-width: 0px; margin-right: 0px" title="SolutionFolders" src="http://www.aaronlowe.net/wp-content/uploads/SolutionFolders.png" border="0" alt="SolutionFolders" width="138" height="244" align="left" /></a>So while we&rsquo;re all used to utilizing Solution Explorer for our projects, for Database projects please be aware and use Schema view unless you have to deal with the actual files themselves.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.aaronlowe.net/archive/2009/10/vsdbpro-multiple-schemas/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>VSDBPro project dependency</title>
		<link>http://www.aaronlowe.net/archive/2009/10/vsdbpro-project-dependency/</link>
		<comments>http://www.aaronlowe.net/archive/2009/10/vsdbpro-project-dependency/#comments</comments>
		<pubDate>Fri, 02 Oct 2009 08:00:00 +0000</pubDate>
		<dc:creator>Aaron Lowe</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[VSDBPro]]></category>

		<guid isPermaLink="false">/post/2009/10/02/VSDBPro-project-dependency.aspx</guid>
		<description><![CDATA[So I&#8217;ve been using Visual Studio for Database Professionals (aka VSDBPro, aka DataDude) consistently this year for primarily new database development, both for Data Warehouses and OLTP Databases.&#160; This will be the first in what hopefully will become a series of posts about Database projects. In Database Professional there is are two types of projects, [...]]]></description>
			<content:encoded><![CDATA[<p>So I&rsquo;ve been using Visual Studio for Database Professionals (aka VSDBPro, aka DataDude) consistently this year for primarily new database development, both for Data Warehouses and OLTP Databases.&nbsp; This will be the first in what hopefully will become a series of posts about Database projects.</p>
<p>In Database Professional there is are two types of projects, the database project and the database server project.&nbsp; The database project would be the user database while the database server project would be the master database.&nbsp; Neither one is specific to a particular server or instance, it&rsquo;s a Visual Studio project which can be deployed on a single or multiple instances as you need.</p>
<p>You can also create dependencies between projects so you can have a database project which had a dependency on a database server project.&nbsp; Why would you do this you ask?&nbsp; The most straight forward example would be the login to user relationship.&nbsp; You could have a database server project which creates your logins, and a database project which then creates the users in that user database mapped back to the logins in the server project.</p>
<p>You can reference a database project one of three ways:</p>
<ol>
<li>Project within the solution</li>
<li>.schema file (DB projects don&rsquo;t create .dll files)</li>
<li>Server and database variables</li>
</ol>
<p>The first two are pretty straight forward as you would just select a project or a .schema from your workspace, so let&rsquo;s look at how you would utilize variables for reference.&nbsp; First here&rsquo;s the screen to create a dependency: <br /><a href="http://www.flickr.com/photos/vendoran/3967650458/" target="_blank"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="DBReference" src="http://www.aaronlowe.net/wp-content/uploads/DBReference_1.jpg" border="0" alt="DBReference" width="244" height="194" /></a></p>
<p>Easy enough, just enter the variables and you would have:</p>
<p><a href="http://www.flickr.com/photos/vendoran/3967695646/" target="_blank"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="AddDBReference" src="http://www.aaronlowe.net/wp-content/uploads/AddDBReference_1.png" border="0" alt="AddDBReference" width="244" height="195" /></a></p>
<p>You&rsquo;ll notice in the variables the characters %(), this is what tells the Project that these are variables, and I didn&rsquo;t enter the variables this way, I just entered ServerName and when I tabbed out of the filed the $() were automatically added.&nbsp; So now you can see the variables in your command variables dialog (under project properties).&nbsp; The first two are created with every project and you&rsquo;ll see since I specified a value up above, the value is already used, instead of needing to set it at deployment time.</p>
<p><a href="http://www.flickr.com/photos/vendoran/3966923575/" target="_blank"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="CMdVars" src="http://www.aaronlowe.net/wp-content/uploads/CMdVars_1.png" border="0" alt="CMdVars" width="244" height="120" /></a></p>
<p>So now that we have the variables, how does this actually get used when we go to deployment?&nbsp; I&rsquo;m glad you asked, on deployment a .sql file is created that utilized sqlcmd mode.&nbsp; So the output at deployment time time will be:</p>
<p><a href="http://www.flickr.com/photos/vendoran/3966931021/" target="_blank"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="SQLCmd" src="http://www.aaronlowe.net/wp-content/uploads/SQLCmd_1.png" border="0" alt="SQLCmd" width="244" height="213" /></a></p>
<p>Notice that there is no value for the DefaultDataPath, as I never did set it at deployment time.&nbsp; So there you have it, you can now parameterize your project dependencies!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.aaronlowe.net/archive/2009/10/vsdbpro-project-dependency/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
