<?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>Arcane Code</title>
	<atom:link href="http://arcanecode.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://arcanecode.com</link>
	<description>Making Microsoft .Net Development Magical</description>
	<lastBuildDate>Sun, 19 May 2013 01:15:54 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='arcanecode.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Arcane Code</title>
		<link>http://arcanecode.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://arcanecode.com/osd.xml" title="Arcane Code" />
	<atom:link rel='hub' href='http://arcanecode.com/?pushpress=hub'/>
		<item>
		<title>Updating AdventureWorksDW2012 for Today</title>
		<link>http://arcanecode.com/2013/05/07/updating-adventureworksdw2012-for-today/</link>
		<comments>http://arcanecode.com/2013/05/07/updating-adventureworksdw2012-for-today/#comments</comments>
		<pubDate>Wed, 08 May 2013 01:48:34 +0000</pubDate>
		<dc:creator>arcanecode</dc:creator>
				<category><![CDATA[Business Intelligence]]></category>
		<category><![CDATA[Data Warehousing]]></category>
		<category><![CDATA[DW/BI]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Adventure Works]]></category>

		<guid isPermaLink="false">https://arcanecode.wordpress.com/?p=2342</guid>
		<description><![CDATA[Like many of my fellow MVPs and Presenters, I use the Adventure Works sample data from Microsoft to do my presentations. Being a BI guy, I specifically use the AdventureWorksDW2012 version, the Data Warehouse of Adventure Works. I think you’d agree though it’s gotten a little long in the tooth. All of dates range from [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=arcanecode.com&#038;blog=340781&#038;post=2342&#038;subd=arcanecode&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Like many of my fellow MVPs and Presenters, I use the Adventure Works sample data from Microsoft to do my presentations. Being a BI guy, I specifically use the AdventureWorksDW2012 version, the Data Warehouse of Adventure Works. I think you’d agree though it’s gotten a little long in the tooth. All of dates range from 2005 to 2008. This is especially irritating when demonstrating features reliant on the current date ( think GETDATE() or NOW() ). </p>
<p>Before you read further, let me stress again this is NOT for the typical AdventureWorks2012 database. This script is for the Data Warehouse version, AdventureWorks<strong>DW</strong>2012. </p>
<p>I scoured the search engines but couldn’t find anyone who had taken time to come up with a way to update the database. Finally fed up, I did it myself. Below is a script which will add five years to each date in AdventureWorksDW2012. 2008 becomes 2013, 2007 becomes 2012, and so on. The script, below, turned out to be pretty simple. </p>
<p>Before you begin though, a few prerequisites. First, you will need to have AdventureWorksDW2012 installed on your system. A friend and co-worker, Bradley Ball (<a href="http://twitter.com/sqlballs" target="_blank">@SQLBalls</a> | <a href="http://www.sqlballs.com/" target="_blank">blog</a> ) pointed out one issue which I’ll pass along. He had some issues with the version of AdventureWorksDW2012 located at <a href="http://msftdbprodsamples.codeplex.com/releases/view/55330">http://msftdbprodsamples.codeplex.com/releases/view/55330</a>. When he just grabbed the mdf file and tried to create the database using the attach_rebuild_log option it came out corrupted. Instead he suggested the version stored at <a href="http://www.wrox.com/WileyCDA/Section/Wrox-Books-Using-the-SQL-Server-2012-RTM-Database-Examples-Download.id-811144.html?DW_1118479580.zip">http://www.wrox.com/WileyCDA/Section/Wrox-Books-Using-the-SQL-Server-2012-RTM-Database-Examples-Download.id-811144.html?DW_1118479580.zip</a>. (I don’t think Wrox will mind, as I and many of my co-workers have written books for them, nice folks.)</p>
<p>Next, please note this script was written with SQL Server 2012 in mind. It could easily be adapted for 2008R2 by tweaking a few paths. Speaking of which, I use the default paths for everything, you’ll need to alter if you used other paths. </p>
<p>Not wanting to mess with the original AdventureWorksDW2012, in Step 1 (these steps are numbered in the script below) I make a backup of the existing 2012 version. I then do a restore, renaming it to AdventureWorksDW2013. Be warned, if you have run this before and AdventureWorksDW2013 exists it will be deleted. This might be good if you want an easy way to reset your 2013 version, if not alter the script for your needs. </p>
<p>Later I will be inserting dates. I have a handy little routine that converts a traditional datetime data type to an integer, using the traditional YYYYMMDD common for data warehouse date keys. I probably could have done this using some version of FORMAT but I already had the routine written so I just grabbed and reused it. Note it also does some bounds checking, etc that really wasn’t needed here, but like I said I did a grab and reuse. So in Step 2 I create the function. </p>
<p>In step 3 I tackle the biggest task of inserting new rows into the date dimension. The DimDate table already had dates through the end of 2010, so I only had to generate 2011-2013. Inside a WHILE loop I iterate over each date individually, do the calculations to break out the various pieces of a date such as month number, quarter number, etc, and do an INSERT into the DimDate table. If you recall, the DimDate table in AdventureWorks has mult-language versions of the month and day names. I simply read the existing ones into table variables, then in the SELECT part of the INSERT INTO… SELECT statement do a join to these two table variables. </p>
<p>Of course to do that, I had to have a table to select from. None of my date data though existed in the table, each piece of data was generated from the CurrentDate variable. So I simply created a third table variable named BogusTable, and inserted a single row in it. This gave me something to join the month and day name tables to. I suppose I could have used CASE statements for each of the names, but this was more fun. </p>
<p>With the dates added to DimDate, it was time to move on to the Fact tables. In some cases it was very simple. For example, in Step 4.1 I just add 50,000 to the date key. Why 50,000? Simple date math. The dates are integers, 20080101 is really 20,080,101. To bring it up to 2013, I simply added 50,000, thus 20,013,101 or 20130101. </p>
<p>The two Sales fact tables had dates on leap year from 2008. To fix those I simply backed those up a day, shifting them to February 28th. I took a slightly different approach with the Currency Rate fact table, simply shifting the 2008 leap year to 2012 leap year, then omitting February 29th from the rest of the update. Also note that on this and the Product Inventory table, the Date Key was actually part of the Primary Key of the tables. Thus I had to first drop the Primary Key, make the changes to the dates, then recreate the Primary Key. </p>
<p>One last note on the Fact tables, all of the dates in the Call Center table were set to 2010. For those I merely added 30,000, shifting them from 2010 to 2013. (Don’t ask me why those have 2010 dates when the rest of the sample data is 2005-2008. I have not a clue.)</p>
<p>As a last and final step, Step 5, I drop the little helper function DateToDateId I created way back in Step 2. And that’s it! You now have a handy demo / practice database with dates that are actually current. </p>
<p>A big thanks to my co-workers at Pragmatic Works (<a href="https://twitter.com/pragmaticworks" target="_blank">@PragmaticWorks</a> | <a href="http://pragmaticworks.com">http://pragmaticworks.com</a> ) for helping me test this out and making sure it worked with their stuff. </p>
<p>Enjoy!</p>
<p>&#160;</p>
<p>PS Most browsers don’t seem to render the code in a monospace font. Be assured when you paste into SSMS everything should line back up again, assuming of course you use a monospace font in SSMS. </p>
<p>&#160;</p>
<div id="codeSnippetWrapper">
<pre id="codeSnippet" style="overflow:visible;font-size:8pt;font-family:&#039;color:black;direction:ltr;text-align:left;margin:0;line-height:12pt;width:100%;background-color:#f4f4f4;border-style:none;padding:0;"><span style="color:#008000;">/*-----------------------------------------------------------------------------------------------*/</span><br /><span style="color:#008000;">/* Updating AdventureWorks2012 for Today                                                         */</span><br /><span style="color:#008000;">/*                                                                                               */</span><br /><span style="color:#008000;">/* Robert C. Cain, http://arcanecode.com @ArcaneCode                                             */</span><br /><span style="color:#008000;">/*                                                                                               */</span><br /><span style="color:#008000;">/* Script Copyright (c) 2013 by Robert C. Cain                                                   */</span><br /><span style="color:#008000;">/* AdventureWorks database Copyright (c) Microsoft.                                              */</span><br /><span style="color:#008000;">/*                                                                                               */</span><br /><span style="color:#008000;">/* This script will make a backup of the AdventureWorks2012DW database, then copy and restore it */</span><br /><span style="color:#008000;">/* as AdventureWorksDW2013. It will then update it for current dates. 2008 now becomes 2013,     */</span><br /><span style="color:#008000;">/* 2007 is now 2012, and so forth. This script is dependent on the AdventureWorks2012DW sample   */</span><br /><span style="color:#008000;">/* database already being installed. It won't change AdventureWorksDW2012 in anyway.             */</span><br /><span style="color:#008000;">/*                                                                                               */</span><br /><span style="color:#008000;">/* Be warned, if AdventureWorksDW2013 exists, it will be deleted as part of this process.        */</span><br /><span style="color:#008000;">/*                                                                                               */</span><br /><span style="color:#008000;">/*-----------------------------------------------------------------------------------------------*/</span><br /><br /><span style="color:#0000ff;">PRINT</span> <span style="color:#006080;">'Updating AdventureWorks2012 for Today - Starting'</span><br /><span style="color:#0000ff;">GO</span><br /><br /><span style="color:#008000;">/*-----------------------------------------------------------------------------------------------*/</span><br /><span style="color:#008000;">/* Step 1 - Make a copy of AdventureWorksDW2012 and restore as AdventureWorksDW2013              */</span><br /><span style="color:#008000;">/*-----------------------------------------------------------------------------------------------*/</span><br /><span style="color:#0000ff;">SET</span> NOCOUNT <span style="color:#0000ff;">ON</span><br /><br /><span style="color:#0000ff;">USE</span> [master]<br /><br /><span style="color:#008000;">-- Step 1.1. Make a backup of AdventureWorksDW2012 ----------------------------------------------</span><br /><span style="color:#0000ff;">PRINT</span> <span style="color:#006080;">'Backing up AdventureWorksDW2012'</span><br /><span style="color:#0000ff;">GO</span><br /><br /><span style="color:#0000ff;">BACKUP</span> <span style="color:#0000ff;">DATABASE</span> [AdventureWorksDW2012] <br />    <span style="color:#0000ff;">TO</span> <span style="color:#0000ff;">DISK</span> = N<span style="color:#006080;">'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\Backup\AdventureWorksDW2012.bak'</span> <br />  <span style="color:#0000ff;">WITH</span> NOFORMAT, <br />       INIT,  <br />       NAME = N<span style="color:#006080;">'AdventureWorksDW2012-Full Database Backup'</span>, <br />       SKIP, <br />       NOREWIND, <br />       NOUNLOAD,  <br />       STATS = 10<br /><span style="color:#0000ff;">GO</span><br /><br /><br /><span style="color:#008000;">-- Step 1.2. Delete the database AdventureWorksDW2013 if it exists ------------------------------</span><br /><span style="color:#0000ff;">PRINT</span> <span style="color:#006080;">'Deleting AdventureWorksDW2013, if it exists'</span><br /><span style="color:#0000ff;">GO</span><br /><br /><span style="color:#0000ff;">IF</span> (<span style="color:#0000ff;">EXISTS</span> (<span style="color:#0000ff;">SELECT</span> 1 <br />              <span style="color:#0000ff;">FROM</span> master.dbo.sysdatabases <br />             <span style="color:#0000ff;">WHERE</span> name = <span style="color:#006080;">'AdventureWorksDW2013'</span> )<br />   )<br />   <span style="color:#0000ff;">EXEC</span> msdb.dbo.sp_delete_database_backuphistory @database_name = N<span style="color:#006080;">'AdventureWorksDW2013'</span><br /><span style="color:#0000ff;">GO</span><br /><br /><span style="color:#0000ff;">IF</span> (<span style="color:#0000ff;">EXISTS</span> (<span style="color:#0000ff;">SELECT</span> 1 <br />              <span style="color:#0000ff;">FROM</span> master.dbo.sysdatabases <br />             <span style="color:#0000ff;">WHERE</span> name = <span style="color:#006080;">'AdventureWorksDW2013'</span> )<br />   )<br />   <span style="color:#0000ff;">DROP</span> <span style="color:#0000ff;">DATABASE</span> [AdventureWorksDW2013]<br /><span style="color:#0000ff;">GO</span><br /><br /><span style="color:#008000;">-- Step 1.3. Restore the database to a new copy -------------------------------------------------</span><br /><span style="color:#0000ff;">PRINT</span> <span style="color:#006080;">'Restoring AdventureWorksDW2012 to AdventureWorksDW2013'</span><br /><span style="color:#0000ff;">GO</span><br /><br /><span style="color:#0000ff;">RESTORE</span> <span style="color:#0000ff;">DATABASE</span> [AdventureWorksDW2013] <br />   <span style="color:#0000ff;">FROM</span>  <span style="color:#0000ff;">DISK</span> = N<span style="color:#006080;">'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\Backup\AdventureWorksDW2012.bak'</span> <br />   <span style="color:#0000ff;">WITH</span>  <span style="color:#0000ff;">FILE</span> = 1,  <br />   MOVE N<span style="color:#006080;">'AdventureWorksDW2012_Data'</span> <br />     <span style="color:#0000ff;">TO</span> N<span style="color:#006080;">'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\AdventureWorksDW2013_Data.mdf'</span>,  <br />   MOVE N<span style="color:#006080;">'AdventureWorksDW2012_Log'</span> <br />     <span style="color:#0000ff;">TO</span> N<span style="color:#006080;">'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\AdventureWorksDW2013_log.ldf'</span>,  <br />        NOUNLOAD,  STATS = 5<br /><br /><span style="color:#0000ff;">GO</span><br /><br /><span style="color:#0000ff;">PRINT</span> <span style="color:#006080;">'Done Creating AdventureWorksDW2013'</span><br /><span style="color:#0000ff;">GO</span><br /><br /><br /><br /><span style="color:#008000;">/*-----------------------------------------------------------------------------------------------*/</span><br /><span style="color:#008000;">/* Step 2. Create a helper function to convert dates to a YYYYMMDD format Date Id.               */</span><br /><span style="color:#008000;">/*-----------------------------------------------------------------------------------------------*/</span><br /><br /><span style="color:#0000ff;">USE</span> [AdventureWorksDW2013]<br /><span style="color:#0000ff;">GO</span><br /><br /><span style="color:#0000ff;">IF</span> <span style="color:#0000ff;">EXISTS</span> (<span style="color:#0000ff;">SELECT</span> [name] <span style="color:#0000ff;">FROM</span> [sys].[all_objects] <span style="color:#0000ff;">WHERE</span> [name] = <span style="color:#006080;">'DateToDateId'</span>)<br />  <span style="color:#0000ff;">DROP</span> <span style="color:#0000ff;">FUNCTION</span> [dbo].[DateToDateId];<br /><span style="color:#0000ff;">GO</span><br /><br /><span style="color:#0000ff;">CREATE</span> <span style="color:#0000ff;">FUNCTION</span> [dbo].[DateToDateId]<br />(<br />  @<span style="color:#0000ff;">Date</span> DATETIME<br />)<br /><span style="color:#0000ff;">RETURNS</span> <span style="color:#0000ff;">INT</span><br /><span style="color:#0000ff;">AS</span><br /><span style="color:#0000ff;">BEGIN</span><br /><br />  <span style="color:#0000ff;">DECLARE</span> @DateId  <span style="color:#0000ff;">AS</span> <span style="color:#0000ff;">INT</span><br />  <span style="color:#0000ff;">DECLARE</span> @TodayId <span style="color:#0000ff;">AS</span> <span style="color:#0000ff;">INT</span><br /><br />  <span style="color:#0000ff;">SET</span> @TodayId = <span style="color:#0000ff;">YEAR</span>(GETDATE()) * 10000<br />               + <span style="color:#0000ff;">MONTH</span>(GETDATE()) * 100<br />               + <span style="color:#0000ff;">DAY</span>(GETDATE())         <br /><br />  <span style="color:#008000;">-- If the date is missing, or a placeholder for a missing date, set to the Id for missing dates</span><br />  <span style="color:#008000;">-- Else convert the date to an integer</span><br />  <span style="color:#0000ff;">IF</span> @<span style="color:#0000ff;">Date</span> <span style="color:#0000ff;">IS</span> <span style="color:#0000ff;">NULL</span> <span style="color:#0000ff;">OR</span> @<span style="color:#0000ff;">Date</span> = <span style="color:#006080;">'1900-01-01'</span> <span style="color:#0000ff;">OR</span> @<span style="color:#0000ff;">Date</span> = -1<br />    <span style="color:#0000ff;">SET</span> @DateId = -1  <br />  <span style="color:#0000ff;">ELSE</span><br />    <span style="color:#0000ff;">BEGIN</span><br />      <span style="color:#0000ff;">SET</span> @DateId = <span style="color:#0000ff;">YEAR</span>(@<span style="color:#0000ff;">Date</span>) * 10000<br />                  + <span style="color:#0000ff;">MONTH</span>(@<span style="color:#0000ff;">Date</span>) * 100<br />                  + <span style="color:#0000ff;">DAY</span>(@<span style="color:#0000ff;">Date</span>)         <br />    <span style="color:#0000ff;">END</span>  <br />  <br />  <span style="color:#008000;">-- If there's any data prior to 2000 it was incorrectly entered, mark it as missing</span><br />  <span style="color:#0000ff;">IF</span> @DateId <span style="color:#0000ff;">BETWEEN</span> 0 <span style="color:#0000ff;">AND</span> 19991231 <br />    <span style="color:#0000ff;">SET</span> @DateId = -1<br /><br />  <span style="color:#008000;">-- Commented out for this project as future dates are OK</span><br />  <span style="color:#008000;">-- If the date is in the future, don't allow it, change to missing</span><br />  <span style="color:#008000;">-- IF @DateId &gt; @TodayId </span><br />  <span style="color:#008000;">--   SET @DateId = -1</span><br /><br />  <span style="color:#0000ff;">RETURN</span> @DateId<br /><br /><span style="color:#0000ff;">END</span><br /><br /><span style="color:#0000ff;">GO</span><br /><br /><br /><br /><br /><span style="color:#008000;">/*-----------------------------------------------------------------------------------------------*/</span><br /><span style="color:#008000;">/* Step 3. Add new dates to the dbo.DimDate table.                                               */</span><br /><span style="color:#008000;">/*-----------------------------------------------------------------------------------------------*/</span><br /><span style="color:#0000ff;">PRINT</span> <span style="color:#006080;">'Adding new dates to dbo.DimDate'</span><br /><span style="color:#0000ff;">GO</span><br /><br /><span style="color:#0000ff;">SET</span> NOCOUNT <span style="color:#0000ff;">ON</span><br /><br /><span style="color:#008000;">-- Later we will be writing an INSERT INTO... SELECT FROM to insert the new record. I want to </span><br /><span style="color:#008000;">-- join the day and month name memory variable tables, but need to have something to join to. </span><br /><span style="color:#008000;">-- Since everything is calculated, we'll just create this little bogus table to have something</span><br /><span style="color:#008000;">-- to select from.</span><br /><span style="color:#0000ff;">DECLARE</span> @BogusTable <span style="color:#0000ff;">TABLE</span><br />  ( PK TINYINT)<br /><br />INSERT <span style="color:#0000ff;">INTO</span> @BogusTable <span style="color:#0000ff;">SELECT</span> 1;<br /><br /><br /><span style="color:#008000;">-- Create a table variable to hold the days of the week with their various language versions</span><br /><span style="color:#0000ff;">DECLARE</span> @DayNameTable <span style="color:#0000ff;">TABLE</span><br />  ( [DayNumberOFWeek]      TINYINT<br />  , [EnglishDayNameOfWeek] NVARCHAR(10)<br />  , [SpanishDayNameOfWeek] NVARCHAR(10)<br />  , [FrenchDayNameOfWeek]  NVARCHAR(10)<br />  )<br /><br />INSERT <span style="color:#0000ff;">INTO</span> @DayNameTable<br /><span style="color:#0000ff;">SELECT</span> <span style="color:#0000ff;">DISTINCT</span> <br />       [DayNumberOFWeek]      <br />     , [EnglishDayNameOfWeek] <br />     , [SpanishDayNameOfWeek] <br />     , [FrenchDayNameOfWeek]  <br />  <span style="color:#0000ff;">FROM</span> dbo.DimDate<br /><br /><span style="color:#008000;">-- Create a month table to hold the months and their language versions.</span><br /><span style="color:#0000ff;">DECLARE</span> @MonthNameTable <span style="color:#0000ff;">TABLE</span><br />  ( [MonthNumberOfYear] TINYINT<br />  , [EnglishMonthName]  NVARCHAR(10)<br />  , [SpanishMonthName]  NVARCHAR(10)<br />  , [FrenchMonthName]   NVARCHAR(10)<br />  )<br /><br />INSERT <span style="color:#0000ff;">INTO</span> @MonthNameTable<br /><span style="color:#0000ff;">SELECT</span> <span style="color:#0000ff;">DISTINCT</span><br />       [MonthNumberOfYear] <br />     , [EnglishMonthName]  <br />     , [SpanishMonthName]  <br />     , [FrenchMonthName]   <br />  <span style="color:#0000ff;">FROM</span> dbo.DimDate<br /><br /><span style="color:#008000;">-- This is the start and end date ranges to use to populate the </span><br /><span style="color:#008000;">-- dbo.DimDate dimension. Change if it's 2014 and you run across this script.</span><br /><span style="color:#0000ff;">DECLARE</span> @FromDate <span style="color:#0000ff;">AS</span> <span style="color:#0000ff;">DATE</span> = <span style="color:#006080;">'2011-01-01'</span><br /><span style="color:#0000ff;">DECLARE</span> @ThruDate <span style="color:#0000ff;">AS</span> <span style="color:#0000ff;">DATE</span> = <span style="color:#006080;">'2013-12-31'</span><br /><br /><span style="color:#008000;">-- CurrentDate will be incremented each time through the loop below.</span><br /><span style="color:#0000ff;">DECLARE</span> @CurrentDate <span style="color:#0000ff;">AS</span> <span style="color:#0000ff;">DATE</span><br /><span style="color:#0000ff;">SET</span> @CurrentDate = @FromDate<br /><br /><span style="color:#008000;">-- FiscalDate will be set six months into the future from the CurrentDate</span><br /><span style="color:#0000ff;">DECLARE</span> @FiscalDate  <span style="color:#0000ff;">AS</span> <span style="color:#0000ff;">DATE</span><br /><br /><span style="color:#008000;">-- Now we simply loop over every date between the From and Thru, inserting the</span><br /><span style="color:#008000;">-- calculated values into DimDate.</span><br /><span style="color:#0000ff;">WHILE</span> @CurrentDate &lt;= @ThruDate<br /><span style="color:#0000ff;">BEGIN</span><br /><br />  <span style="color:#0000ff;">SET</span> @FiscalDate = DATEADD(m, 6, @CurrentDate)<br /><br />  INSERT <span style="color:#0000ff;">INTO</span> dbo.DimDate<br />  <span style="color:#0000ff;">SELECT</span> [dbo].[DateToDateId](@CurrentDate)<br />       , @CurrentDate<br />       , DATEPART(dw, @CurrentDate) <span style="color:#0000ff;">AS</span> DayNumberOFWeek<br />       , d.EnglishDayNameOfWeek<br />       , d.SpanishDayNameOfWeek<br />       , d.FrenchDayNameOfWeek<br />       , <span style="color:#0000ff;">DAY</span>(@CurrentDate) <span style="color:#0000ff;">AS</span> DayNumberOfMonth<br />       , DATEPART(dy, @CurrentDate) <span style="color:#0000ff;">AS</span> DayNumberOfYear<br />       , DATEPART(wk, @CurrentDate) <span style="color:#0000ff;">AS</span> WeekNumberOfYear<br />       , m.EnglishMonthName<br />       , m.SpanishMonthName<br />       , m.FrenchMonthName<br />       , <span style="color:#0000ff;">MONTH</span>(@CurrentDate) <span style="color:#0000ff;">AS</span> MonthNumberOfYear<br />       , DATEPART(q, @CurrentDate) <span style="color:#0000ff;">AS</span> CalendarQuarter<br />       , <span style="color:#0000ff;">YEAR</span>(@CurrentDate) <span style="color:#0000ff;">AS</span> CalendarYear<br />       , IIF(<span style="color:#0000ff;">MONTH</span>(@CurrentDate) &lt; 7, 1, 2) <span style="color:#0000ff;">AS</span> CalendarSemester<br />       , DATEPART(q, @FiscalDate) <span style="color:#0000ff;">AS</span> FiscalQuarter<br />       , <span style="color:#0000ff;">YEAR</span>(@FiscalDate) <span style="color:#0000ff;">AS</span> FiscalYear<br />       , IIF(<span style="color:#0000ff;">MONTH</span>(@FiscalDate) &lt; 7, 1, 2) <span style="color:#0000ff;">AS</span> FiscalSemester<br />    <span style="color:#0000ff;">FROM</span> @BogusTable<br />    <span style="color:#0000ff;">JOIN</span> @DayNameTable d<br />      <span style="color:#0000ff;">ON</span> DATEPART(dw, @CurrentDate) = d.[DayNumberOFWeek]<br />    <span style="color:#0000ff;">JOIN</span> @MonthNameTable m<br />      <span style="color:#0000ff;">ON</span> <span style="color:#0000ff;">MONTH</span>(@CurrentDate) = m.MonthNumberOfYear<br /><br />  <span style="color:#0000ff;">SET</span> @CurrentDate = DATEADD(d, 1, @CurrentDate)<br /><span style="color:#0000ff;">END</span><br /><span style="color:#0000ff;">GO</span><br /><br /><span style="color:#008000;">-- If you want to verify you can uncomment this line.</span><br /><span style="color:#008000;">-- SELECT * FROM dbo.DimDate WHERE DateKey &gt; 20110000</span><br /><br /><span style="color:#0000ff;">PRINT</span> <span style="color:#006080;">'Done adding new dates to dbo.DimDate'</span><br /><span style="color:#0000ff;">GO</span><br /><br /><br /><br /><br /><br /><span style="color:#008000;">/*-----------------------------------------------------------------------------------------------*/</span><br /><span style="color:#008000;">/* Step 4. Update the Fact Tables with the new dates.                                            */</span><br /><span style="color:#008000;">/*-----------------------------------------------------------------------------------------------*/</span><br /><br /><br /><span style="color:#0000ff;">PRINT</span> <span style="color:#006080;">'Update Fact Tables'</span><br /><span style="color:#0000ff;">GO</span><br /><br /><span style="color:#0000ff;">SET</span> NOCOUNT <span style="color:#0000ff;">ON</span><br /><br /><span style="color:#008000;">-- To move forward five years, we simply add 50,000 to the date key</span><br /><br /><span style="color:#008000;">-- 4.1 FactFinance ------------------------------------------------------------------------------</span><br /><span style="color:#0000ff;">PRINT</span> <span style="color:#006080;">'  FactFinance'</span><br /><span style="color:#0000ff;">GO</span><br /><br /><span style="color:#0000ff;">UPDATE</span> [dbo].[FactFinance]<br />   <span style="color:#0000ff;">SET</span> [DateKey] = [DateKey] + 50000;<br /><br /><br /><span style="color:#008000;">-- 4.2 FactInternetSales ------------------------------------------------------------------------</span><br /><span style="color:#0000ff;">PRINT</span> <span style="color:#006080;">'  FactInternetSales'</span><br /><span style="color:#0000ff;">GO</span><br /><br /><span style="color:#008000;">-- There are a few rows where the due date is on leap year. Update these to back off a day </span><br /><span style="color:#008000;">-- so the date add works OK</span><br /><span style="color:#0000ff;">UPDATE</span> [dbo].[FactInternetSales]<br />   <span style="color:#0000ff;">SET</span> [OrderDateKey] = 20080228<br />     , [OrderDate] = <span style="color:#006080;">'2008-02-28'</span><br /> <span style="color:#0000ff;">WHERE</span> [OrderDateKey] = 20080229<br /><br /><span style="color:#0000ff;">UPDATE</span> [dbo].[FactInternetSales]<br />   <span style="color:#0000ff;">SET</span> [DueDateKey] = 20080228<br />     , [DueDate] = <span style="color:#006080;">'2008-02-28'</span><br /> <span style="color:#0000ff;">WHERE</span> [DueDateKey] = 20080229<br /><br /><span style="color:#0000ff;">UPDATE</span> [dbo].[FactInternetSales]<br />   <span style="color:#0000ff;">SET</span> [ShipDateKey] = 20080228<br />     , [ShipDate] = <span style="color:#006080;">'2008-02-28'</span><br /> <span style="color:#0000ff;">WHERE</span> [ShipDateKey] = 20080229<br /><br /><span style="color:#008000;">-- Now update the rest of the days. </span><br /><span style="color:#0000ff;">UPDATE</span> [dbo].[FactInternetSales]<br />   <span style="color:#0000ff;">SET</span> [OrderDateKey] = [OrderDateKey] + 50000<br />     , [DueDateKey] = [DueDateKey] + 50000<br />     , [ShipDateKey] = [ShipDateKey] + 50000<br />     , [OrderDate] = DATEADD(yy, 5, [OrderDate])<br />     , [DueDate] = DATEADD(yy, 5, [DueDate])<br />     , [ShipDate] = DATEADD(yy, 5, [ShipDate])<br /><br /><br /><span style="color:#008000;">-- 4.3 FactResellerSales ------------------------------------------------------------------------</span><br /><span style="color:#0000ff;">PRINT</span> <span style="color:#006080;">'  FactResellerSales'</span><br /><span style="color:#0000ff;">GO</span><br /><br /><span style="color:#008000;">-- As with Internet Sales, there are rows where the due date is on leap year. </span><br /><span style="color:#008000;">-- Update these to back off a day so the date add works OK</span><br /><span style="color:#0000ff;">UPDATE</span> [dbo].[FactResellerSales]<br />   <span style="color:#0000ff;">SET</span> [OrderDateKey] = 20080228<br />     , [OrderDate] = <span style="color:#006080;">'2008-02-28'</span><br /> <span style="color:#0000ff;">WHERE</span> [OrderDateKey] = 20080229<br /><br /><span style="color:#0000ff;">UPDATE</span> [dbo].[FactResellerSales]<br />   <span style="color:#0000ff;">SET</span> [DueDateKey] = 20080228<br />     , [DueDate] = <span style="color:#006080;">'2008-02-28'</span><br /> <span style="color:#0000ff;">WHERE</span> [DueDateKey] = 20080229<br /><br /><span style="color:#0000ff;">UPDATE</span> [dbo].[FactResellerSales]<br />   <span style="color:#0000ff;">SET</span> [ShipDateKey] = 20080228<br />     , [ShipDate] = <span style="color:#006080;">'2008-02-28'</span><br /> <span style="color:#0000ff;">WHERE</span> [ShipDateKey] = 20080229<br /><br /><span style="color:#008000;">-- Now update the table</span><br /><span style="color:#0000ff;">UPDATE</span> [dbo].[FactResellerSales]<br />   <span style="color:#0000ff;">SET</span> [OrderDateKey] = [OrderDateKey] + 50000<br />     , [DueDateKey] = [DueDateKey] + 50000<br />     , [ShipDateKey] = [ShipDateKey] + 50000<br />     , [OrderDate] = DATEADD(yy, 5, [OrderDate])<br />     , [DueDate] = DATEADD(yy, 5, [DueDate])<br />     , [ShipDate] = DATEADD(yy, 5, [ShipDate])<br /><br /><span style="color:#008000;">-- 4.4 FactSalesQuota ---------------------------------------------------------------------------</span><br /><span style="color:#0000ff;">PRINT</span> <span style="color:#006080;">'  FactSalesQuota'</span><br /><span style="color:#0000ff;">GO</span><br /><br /><span style="color:#0000ff;">UPDATE</span> [dbo].[FactSalesQuota] <br />   <span style="color:#0000ff;">SET</span> [DateKey] = [DateKey] + 50000<br /><br /><span style="color:#008000;">-- 4.5 FactSurveyResponse -----------------------------------------------------------------------</span><br /><span style="color:#0000ff;">PRINT</span> <span style="color:#006080;">'  FactSurveyResponse'</span><br /><span style="color:#0000ff;">GO</span><br /><br /><span style="color:#0000ff;">UPDATE</span> [dbo].[FactSurveyResponse]<br />   <span style="color:#0000ff;">SET</span> [DateKey] = [DateKey] + 50000<br /><br /><span style="color:#008000;">-- 4.6 FactCallCenter ---------------------------------------------------------------------------</span><br /><span style="color:#0000ff;">PRINT</span> <span style="color:#006080;">'  FactCallCenter'</span><br /><span style="color:#0000ff;">GO</span><br /><br /><span style="color:#008000;">-- All the rows in call center have a 2010 date, just add 3 years to make these 2013</span><br /><span style="color:#0000ff;">UPDATE</span> [dbo].[FactCallCenter]<br />   <span style="color:#0000ff;">SET</span> [DateKey] = [DateKey] + 30000<br /><br /><br /><span style="color:#008000;">-- 4.7 FactCurrencyRate -------------------------------------------------------------------------</span><br /><span style="color:#0000ff;">PRINT</span> <span style="color:#006080;">'  FactCurrencyRate'</span><br /><span style="color:#0000ff;">GO</span><br /><br /><span style="color:#008000;">-- Because the DateKey is part of the PK, we have to drop the key before we can update it</span><br /><span style="color:#0000ff;">ALTER</span> <span style="color:#0000ff;">TABLE</span> [dbo].[FactCurrencyRate] <span style="color:#0000ff;">DROP</span> <span style="color:#0000ff;">CONSTRAINT</span> [PK_FactCurrencyRate_CurrencyKey_DateKey]<br /><span style="color:#0000ff;">GO</span><br /><br /><span style="color:#008000;">-- Shift the 2008 Leap Year days to 2012 Leap Year</span><br /><span style="color:#0000ff;">UPDATE</span> [dbo].[FactCurrencyRate]<br />   <span style="color:#0000ff;">SET</span> [DateKey] = 20120229<br /> <span style="color:#0000ff;">WHERE</span> [DateKey] = 20080229<br /><br /><span style="color:#008000;">-- Update everything except the leap year we fixed already</span><br /><span style="color:#0000ff;">UPDATE</span> [dbo].[FactCurrencyRate]<br />   <span style="color:#0000ff;">SET</span> [DateKey] = [DateKey] + 50000<br /> <span style="color:#0000ff;">WHERE</span> [DateKey] &lt;&gt; 20120229<br /><br /><span style="color:#008000;">-- Add the PK back</span><br /><span style="color:#0000ff;">ALTER</span> <span style="color:#0000ff;">TABLE</span> [dbo].[FactCurrencyRate] <br />  <span style="color:#0000ff;">ADD</span> <span style="color:#0000ff;">CONSTRAINT</span> [PK_FactCurrencyRate_CurrencyKey_DateKey] <span style="color:#0000ff;">PRIMARY</span> <span style="color:#0000ff;">KEY</span> <span style="color:#0000ff;">CLUSTERED</span> <br />      ( [CurrencyKey] <span style="color:#0000ff;">ASC</span>,<br />        [DateKey] <span style="color:#0000ff;">ASC</span><br />      )<br /> <span style="color:#0000ff;">WITH</span> ( PAD_INDEX = <span style="color:#0000ff;">OFF</span><br />      , STATISTICS_NORECOMPUTE = <span style="color:#0000ff;">OFF</span><br />      , SORT_IN_TEMPDB = <span style="color:#0000ff;">OFF</span><br />      , IGNORE_DUP_KEY = <span style="color:#0000ff;">OFF</span><br />      , ONLINE = <span style="color:#0000ff;">OFF</span><br />      , ALLOW_ROW_LOCKS = <span style="color:#0000ff;">ON</span><br />      , ALLOW_PAGE_LOCKS = <span style="color:#0000ff;">ON</span><br />      ) <span style="color:#0000ff;">ON</span> [<span style="color:#0000ff;">PRIMARY</span>]<br /><span style="color:#0000ff;">GO</span><br /><br /><br /><span style="color:#008000;">-- 4.8 FactProductInventory ---------------------------------------------------------------------</span><br /><span style="color:#0000ff;">PRINT</span> <span style="color:#006080;">'  FactProductInventory'</span><br /><span style="color:#0000ff;">GO</span><br /><br /><span style="color:#008000;">-- As with the previous step, the date is part of the primary key, so we need to drop it first.</span><br /><span style="color:#0000ff;">ALTER</span> <span style="color:#0000ff;">TABLE</span> [dbo].[FactProductInventory] <span style="color:#0000ff;">DROP</span> <span style="color:#0000ff;">CONSTRAINT</span> [PK_FactProductInventory]<br /><span style="color:#0000ff;">GO</span><br /><br /><span style="color:#008000;">-- Shift the 2008 Leap Year days to 2012 Leap Year</span><br /><span style="color:#0000ff;">UPDATE</span> [dbo].[FactProductInventory]<br />   <span style="color:#0000ff;">SET</span> [DateKey] = 20120229<br /> <span style="color:#0000ff;">WHERE</span> [DateKey] = 20080229<br /><br /><span style="color:#008000;">-- Update everything except the leap year we fixed already</span><br /><span style="color:#0000ff;">UPDATE</span> [dbo].[FactProductInventory]<br />   <span style="color:#0000ff;">SET</span> [DateKey] = [DateKey] + 50000<br /> <span style="color:#0000ff;">WHERE</span> [DateKey] &lt;&gt; 20120229<br /> <br /><span style="color:#008000;">-- Add the PK back</span><br /><span style="color:#0000ff;">ALTER</span> <span style="color:#0000ff;">TABLE</span> [dbo].[FactProductInventory] <br />  <span style="color:#0000ff;">ADD</span> <span style="color:#0000ff;">CONSTRAINT</span> [PK_FactProductInventory] <span style="color:#0000ff;">PRIMARY</span> <span style="color:#0000ff;">KEY</span> <span style="color:#0000ff;">CLUSTERED</span> <br />      (  [ProductKey] <span style="color:#0000ff;">ASC</span><br />      , [DateKey] <span style="color:#0000ff;">ASC</span><br />      )<br /> <span style="color:#0000ff;">WITH</span> ( PAD_INDEX = <span style="color:#0000ff;">OFF</span><br />      , STATISTICS_NORECOMPUTE = <span style="color:#0000ff;">OFF</span><br />      , SORT_IN_TEMPDB = <span style="color:#0000ff;">OFF</span><br />      , IGNORE_DUP_KEY = <span style="color:#0000ff;">OFF</span><br />      , ONLINE = <span style="color:#0000ff;">OFF</span><br />      , ALLOW_ROW_LOCKS = <span style="color:#0000ff;">ON</span><br />      , ALLOW_PAGE_LOCKS = <span style="color:#0000ff;">ON</span><br />      ) <span style="color:#0000ff;">ON</span> [<span style="color:#0000ff;">PRIMARY</span>]<br /><span style="color:#0000ff;">GO</span><br /><br /><span style="color:#0000ff;">PRINT</span> <span style="color:#006080;">'Done updating the Fact tables'</span><br /><span style="color:#0000ff;">GO</span><br /><br /><br /><br /><span style="color:#008000;">/*-----------------------------------------------------------------------------------------------*/</span><br /><span style="color:#008000;">/* Step 5. Cleanup, remove the helper function we added earlier.                                 */</span><br /><span style="color:#008000;">/*-----------------------------------------------------------------------------------------------*/</span><br /><span style="color:#0000ff;">PRINT</span> <span style="color:#006080;">'Removing Helper Function'</span><br /><span style="color:#0000ff;">GO</span><br /><br /><span style="color:#0000ff;">IF</span> <span style="color:#0000ff;">EXISTS</span> (<span style="color:#0000ff;">SELECT</span> 1 <span style="color:#0000ff;">FROM</span> [sys].[all_objects] <span style="color:#0000ff;">WHERE</span> [name] = <span style="color:#006080;">'DateToDateId'</span>)<br />  <span style="color:#0000ff;">DROP</span> <span style="color:#0000ff;">FUNCTION</span> [dbo].[DateToDateId];<br /><span style="color:#0000ff;">GO</span><br /><br /><span style="color:#008000;">/*-----------------------------------------------------------------------------------------------*/</span><br /><span style="color:#008000;">/* All done!                                                                                     */</span><br /><span style="color:#008000;">/*-----------------------------------------------------------------------------------------------*/</span><br /><span style="color:#0000ff;">PRINT</span> <span style="color:#006080;">'Updating AdventureWorks2012 for Today - Completed'</span><br /><span style="color:#0000ff;">GO</span><br /></pre>
<p></div>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/arcanecode.wordpress.com/2342/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/arcanecode.wordpress.com/2342/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=arcanecode.com&#038;blog=340781&#038;post=2342&#038;subd=arcanecode&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://arcanecode.com/2013/05/07/updating-adventureworksdw2012-for-today/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/8436cd3ff437697b2608405422efa4da?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">arcanecode</media:title>
		</media:content>
	</item>
		<item>
		<title>SSIS tip for Lookup Transformations</title>
		<link>http://arcanecode.com/2013/04/04/ssis-tip-for-lookup-transformations/</link>
		<comments>http://arcanecode.com/2013/04/04/ssis-tip-for-lookup-transformations/#comments</comments>
		<pubDate>Thu, 04 Apr 2013 06:54:00 +0000</pubDate>
		<dc:creator>arcanecode</dc:creator>
				<category><![CDATA[Business Intelligence]]></category>
		<category><![CDATA[Data Warehousing]]></category>
		<category><![CDATA[DW/BI]]></category>
		<category><![CDATA[SQL Server Integration Services]]></category>
		<category><![CDATA[SSIS]]></category>
		<category><![CDATA[T-SQL]]></category>
		<category><![CDATA[T-SQL; SSIS; SQL Server Business Intelligence;]]></category>

		<guid isPermaLink="false">https://arcanecode.wordpress.com/?p=2337</guid>
		<description><![CDATA[The Lookup Transformation is a cornerstone of almost any SSIS package. The vast majority of packages that load Fact tables use Lookups extensively. Many of these lookups reference the same tables over and over. As we all (hopefully) know by now, opting to lookup against a table is akin to doing a SELECT *. Best [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=arcanecode.com&#038;blog=340781&#038;post=2337&#038;subd=arcanecode&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>The Lookup Transformation is a cornerstone of almost any SSIS package. The vast majority of packages that load Fact tables use Lookups extensively. Many of these lookups reference the same tables over and over. </p>
<p>As we all (hopefully) know by now, opting to lookup against a table is akin to doing a SELECT *. Best practices guide you to only select the columns you really need for a lookup, typically the surrogate key and business key. Because I often reference the same tables over and over, I’ve taken to keeping all my frequently referenced tables in a single SQL file. </p>
<p>I typically store all my projects in a “Projects” folder off my root directory (aka C:\). Under it I create a folder for each project I work on. Within there I create a folder simply called SQL, where I store some SQL scripts. Some are just temporary as I work through issues, or as in this case a good place to store my commonly used lookups. It will wind up looking something like:</p>
<div id="scid:9D7513F9-C04C-4721-824A-2B34F0212519:98e21da1-9665-4375-b221-6c5d0892d668" class="wlWriterEditableSmartContent" style="float:none;margin:0;display:inline;padding:0;">
<pre style="width:458px;height:299px;background-color:White;overflow:auto;"><div><span style="color:#008080;">--</span><span style="color:#008080;"> Employee</span><span style="color:#008080;">
</span><span style="color:#0000FF;">SELECT</span><span style="color:#000000;"> DimEmployeeId, EmployeeBusinessKey
  </span><span style="color:#0000FF;">FROM</span><span style="color:#000000;"> DimEmployee

</span><span style="color:#008080;">--</span><span style="color:#008080;"> Company</span><span style="color:#008080;">
</span><span style="color:#0000FF;">SELECT</span><span style="color:#000000;"> DimCompanyId, CompanyBusinessKey
  </span><span style="color:#0000FF;">FROM</span><span style="color:#000000;"> DimCompany

</span><span style="color:#008080;">--</span><span style="color:#008080;"> Office</span><span style="color:#008080;">
</span><span style="color:#0000FF;">SELECT</span><span style="color:#000000;"> DimOfficeId, OfficeBusinessKey
  </span><span style="color:#0000FF;">FROM</span><span style="color:#000000;"> DimOffice

</span><span style="color:#008080;">--</span><span style="color:#008080;"> More here</span></div></pre>
<p><!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --></div>
<p>That’s a very generic example, but you get the idea. Simple, but very handy. </p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/arcanecode.wordpress.com/2337/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/arcanecode.wordpress.com/2337/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=arcanecode.com&#038;blog=340781&#038;post=2337&#038;subd=arcanecode&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://arcanecode.com/2013/04/04/ssis-tip-for-lookup-transformations/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/8436cd3ff437697b2608405422efa4da?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">arcanecode</media:title>
		</media:content>
	</item>
		<item>
		<title>The Phoenix Project</title>
		<link>http://arcanecode.com/2013/04/02/the-phoenix-project/</link>
		<comments>http://arcanecode.com/2013/04/02/the-phoenix-project/#comments</comments>
		<pubDate>Tue, 02 Apr 2013 16:30:00 +0000</pubDate>
		<dc:creator>arcanecode</dc:creator>
				<category><![CDATA[Big Thinkers]]></category>
		<category><![CDATA[Books]]></category>
		<category><![CDATA[Book Review]]></category>

		<guid isPermaLink="false">https://arcanecode.wordpress.com/?p=2338</guid>
		<description><![CDATA[Just wanted to take a second during my lunch break to let you know about a book called “The Phoenix Project”. Back in ancient times, the 1980’s, a man named&#160; named Eli Goldratt wrote a book entitled “The Goal”. It was about applying a concept called “Theory of Constraints” to the manufacturing process. But this [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=arcanecode.com&#038;blog=340781&#038;post=2338&#038;subd=arcanecode&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Just wanted to take a second during my lunch break to let you know about a book called “The Phoenix Project”. Back in ancient times, the 1980’s, a man named&#160; named Eli Goldratt wrote a book entitled “<a href="http://www.amazon.com/The-Goal-Process-Improvement-ebook/dp/B002LHRM2O/ref=sr_1_1?s=digital-text&amp;ie=UTF8&amp;qid=1364915912&amp;sr=1-1&amp;keywords=The+Goal" target="_blank">The Goal</a>”. It was about applying a concept called “Theory of Constraints” to the manufacturing process. But this wasn’t a boring textbook, but instead written as a novel. At the time a new concept, in the time since it was published the Theory of Constraints has become integrated into almost every manufacturing operation around the world. </p>
<p>“The Phoenix Project” takes the concepts of The Goal and updates them with new management techniques like Agile and Kanban, then applies them to the crazy world of IT. And just like in The Goal, The Phoenix Project uses the form of a novel to tell the story. </p>
<p>Bill is a newly minted VP of IT for Parts Unlimited. Bill inherits a mess, a project pivotal to the success of the company dubbed The Phoenix Project is over two years late and out of control. Not only that, operations in general is in a shambles. Bill is given just a few months to fix it, or the entire IT division will be outsourced. </p>
<p>Paralleling the goal, a mysterious figure steps in to mentor Bill. Using the Socratic method, he guides Bill in the application of Theory of Constraints, Agile, Kanban, and other techniques to the world of IT. Along the way Bill shifts the organization from a silo model of Dev, Operations, and Projects to the unified model known as DevOps. </p>
<p>So why am I delaying my lunch break (my lovely wife makes a killer cube steak) to blog about this? Well until Midnight, Wednesday April 3rd you can get the book for <strong>FREE</strong> in Kindle format from Amazon:</p>
<p><a title="http://www.amazon.com/The-Phoenix-Project-Business-ebook/dp/B00AZRBLHO/ref=sr_1_1?s=digital-text&amp;ie=UTF8&amp;qid=1364912906&amp;sr=1-1&amp;keywords=the+phoenix+project" href="http://www.amazon.com/The-Phoenix-Project-Business-ebook/dp/B00AZRBLHO/ref=sr_1_1?s=digital-text&amp;ie=UTF8&amp;qid=1364912906&amp;sr=1-1&amp;keywords=the+phoenix+project">http://www.amazon.com/The-Phoenix-Project-Business-ebook/dp/B00AZRBLHO/ref=sr_1_1?s=digital-text&amp;ie=UTF8&amp;qid=1364912906&amp;sr=1-1&amp;keywords=the+phoenix+project</a></p>
<p>I had actually paid good money and loved the book so much I’d already started this review post, now that it’s free I’m happy to share with all of you. It’s not a long book, I read most of it on a Friday evening and finished it up on a Saturday. Since finishing it I’ve begun applying some of the concepts to my personal and professional life with good results. If you happen to run across this post after April 3rd I still recommend getting it, even if you have to pay for it like I did. It is well worth your time and money. </p>
<p>Don’t have a Kindle? No problem, there is free Kindle software for all the tablets; iPad, Android and yes even Surface. No device? There’s also a Kindle app for your PC and Mac. If all else fails, there’s even a cloud reader so you can read your books on any web browser. </p>
<p>If you want to know more about DevOps, the authors (Gene Kim, Kevin Behr, and George Spafford) run a website called IT Revolution at <a title="http://itrevolution.com/" href="http://itrevolution.com/">http://itrevolution.com/</a> where you can find out more. </p>
<p>This is a great book that should be required reading for everyone in IT. I believe it will have as big an impact to IT as The Goal did to manufacturing. And if you haven’t read The Goal, get it as well, perhaps even read it first. The Phoenix Project makes several references to The Goal, which will make more sense if you read The Goal first. (The Goal is also available as an audio book from <a href="http://www.audible.com/pd?asin=B002V08DRY" target="_blank">Audible</a>, I’m hoping the Phoenix Project will be converted to audio soon.)</p>
<p>Enjoy, now if you’ll excuse me I have a cube steak with my name on it. </p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/arcanecode.wordpress.com/2338/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/arcanecode.wordpress.com/2338/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=arcanecode.com&#038;blog=340781&#038;post=2338&#038;subd=arcanecode&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://arcanecode.com/2013/04/02/the-phoenix-project/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/8436cd3ff437697b2608405422efa4da?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">arcanecode</media:title>
		</media:content>
	</item>
		<item>
		<title>Run As Robert</title>
		<link>http://arcanecode.com/2013/04/01/run-as-robert/</link>
		<comments>http://arcanecode.com/2013/04/01/run-as-robert/#comments</comments>
		<pubDate>Mon, 01 Apr 2013 23:41:03 +0000</pubDate>
		<dc:creator>arcanecode</dc:creator>
				<category><![CDATA[Business Intelligence]]></category>

		<guid isPermaLink="false">https://arcanecode.wordpress.com/?p=2336</guid>
		<description><![CDATA[Recently I was a guest on Richard Campbell’s podcast “RunAs Radio”. It was a lot of fun, we talked about Business Intelligence as it’s evolved and what its future might be with technologies such as Hadoop up and coming. You can find the interview at: http://www.runasradio.com/default.aspx?showNum=307&#160; One minor correction, in my bio he misread my [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=arcanecode.com&#038;blog=340781&#038;post=2336&#038;subd=arcanecode&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Recently I was a guest on Richard Campbell’s podcast “RunAs Radio”. It was a lot of fun, we talked about Business Intelligence as it’s evolved and what its future might be with technologies such as Hadoop up and coming. You can find the interview at:</p>
<p><a title="http://www.runasradio.com/default.aspx?showNum=307" href="http://www.runasradio.com/default.aspx?showNum=307">http://www.runasradio.com/default.aspx?showNum=307</a>&#160;</p>
<p>One minor correction, in my bio he misread my “MCTS” certification as an MCT. Just wanted to clarify that point since I’m not an MCT (yet, LOL). </p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/arcanecode.wordpress.com/2336/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/arcanecode.wordpress.com/2336/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=arcanecode.com&#038;blog=340781&#038;post=2336&#038;subd=arcanecode&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://arcanecode.com/2013/04/01/run-as-robert/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/8436cd3ff437697b2608405422efa4da?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">arcanecode</media:title>
		</media:content>
	</item>
		<item>
		<title>SSDT &#8211; Error SQL70001 This statement is not recognized in this context</title>
		<link>http://arcanecode.com/2013/03/28/ssdt-error-sql70001-this-statement-is-not-recognized-in-this-context/</link>
		<comments>http://arcanecode.com/2013/03/28/ssdt-error-sql70001-this-statement-is-not-recognized-in-this-context/#comments</comments>
		<pubDate>Thu, 28 Mar 2013 11:44:00 +0000</pubDate>
		<dc:creator>arcanecode</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SSDT]]></category>
		<category><![CDATA[SSDT; SQL Server]]></category>

		<guid isPermaLink="false">https://arcanecode.wordpress.com/?p=2335</guid>
		<description><![CDATA[One of the most common errors I get asked about when using SQL Server Data Tools (SSDT) Database Projects is the error “This statement is not recognized in this context”. This is actually a pretty simple error to fix. Envision this scenario. You have a simple table: CREATE TABLE [dbo].[Test] ( [Id] INT IDENTITY NOT [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=arcanecode.com&#038;blog=340781&#038;post=2335&#038;subd=arcanecode&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>One of the most common errors I get asked about when using SQL Server Data Tools (SSDT) Database Projects is the error “This statement is not recognized in this context”. This is actually a pretty simple error to fix. </p>
<p>Envision this scenario. You have a simple table:</p>
<p> CREATE TABLE [dbo].[Test]  <br />( [Id] INT IDENTITY NOT NULL PRIMARY KEY  <br />, [SomeData] NVARCHAR(20) NOT NULL  <br />)  <br /> 
<p>Great. So then you want to have a post deployment script which will populate it with some default value. Because we are following best practices we creating a post deployment script which then calls the script to populate the default data. </p>
<p>:r .\InsertSomeData.sql</p>
<p>Then we have the script InsertSomeData.sql itself:</p>
<p>INSERT INTO [dbo].[Test] ([SomeData])   <br />VALUES (&#8216;Arcane Code&#8217;)    </p>
<p>After inserting the code, or doing a build, you get this ugly error pop up in the error window:</p>
<p><a href="http://arcanecode.files.wordpress.com/2013/03/image.png"><img title="image" style="display:inline;border-width:0;" border="0" alt="image" src="http://arcanecode.files.wordpress.com/2013/03/image_thumb.png?w=499&#038;h=109" width="499" height="109" /></a> </p>
<p>So what happened? Well, when you went to insert the script you had these options in the dialog:</p>
<p><a href="http://arcanecode.files.wordpress.com/2013/03/image1.png"><img title="image" style="display:inline;border-width:0;" border="0" alt="image" src="http://arcanecode.files.wordpress.com/2013/03/image_thumb1.png?w=644&#038;h=394" width="644" height="394" /></a> </p>
<p>&#160;</p>
<p>If you aren’t careful, you could accidentally pick the “Script (Build)” option (highlighted in blue). This option attempts to compile and run the code as DDL (Data Definition Language, the T-SQL syntax which creates tables, indexes, etc.) syntax. Things like Insert statements though are considered DML (Data Manipulation Language) code, and aren’t eligible to be compiled as part of the project. This is what generates the “This statement is not recognized in this context” error. You are essentially putting DML code where only DDL is allowed. </p>
<p>But don’t despair, this is extremely simple to fix. In SSDT, simply bring up the Properties dialog for the SQL script (click in the SQL script, then View, Properties in the menu). Pick the Build Action property, and change it to None.</p>
<p><a href="http://arcanecode.files.wordpress.com/2013/03/image2.png"><img title="image" style="display:inline;border-width:0;" border="0" alt="image" src="http://arcanecode.files.wordpress.com/2013/03/image_thumb2.png?w=316&#038;h=188" width="316" height="188" /></a> </p>
<p>And that’s it, the error “SQL70001 This statement is not recognized in this context” should now vanish from your error list. </p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/arcanecode.wordpress.com/2335/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/arcanecode.wordpress.com/2335/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=arcanecode.com&#038;blog=340781&#038;post=2335&#038;subd=arcanecode&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://arcanecode.com/2013/03/28/ssdt-error-sql70001-this-statement-is-not-recognized-in-this-context/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/8436cd3ff437697b2608405422efa4da?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">arcanecode</media:title>
		</media:content>

		<media:content url="http://arcanecode.files.wordpress.com/2013/03/image_thumb.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://arcanecode.files.wordpress.com/2013/03/image_thumb1.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://arcanecode.files.wordpress.com/2013/03/image_thumb2.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
		<item>
		<title>Creating a Data Warehouse Date Id in Task Factory Advanced Derived Column Transformation</title>
		<link>http://arcanecode.com/2013/03/25/creating-a-data-warehouse-date-id-in-task-factory-advanced-derived-column-transformation/</link>
		<comments>http://arcanecode.com/2013/03/25/creating-a-data-warehouse-date-id-in-task-factory-advanced-derived-column-transformation/#comments</comments>
		<pubDate>Tue, 26 Mar 2013 01:31:57 +0000</pubDate>
		<dc:creator>arcanecode</dc:creator>
				<category><![CDATA[Business Intelligence]]></category>
		<category><![CDATA[Data Warehousing]]></category>
		<category><![CDATA[DW/BI]]></category>
		<category><![CDATA[Pragmatic Works]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server Integration Services]]></category>
		<category><![CDATA[SSIS]]></category>
		<category><![CDATA[Task Factory]]></category>
		<category><![CDATA[Pragmatic Works; Task Factory; SSIS; SQL Server; SQL Server Integraion Services]]></category>

		<guid isPermaLink="false">https://arcanecode.wordpress.com/?p=2328</guid>
		<description><![CDATA[The company I work for, Pragmatic Works, makes a great tool called Task Factory. It’s a set of transformations that plug into SQL Server Integration Services and provides a wealth of new controls you can use in your packages. One of these is the Advanced Derived Column Transformation. If you are familiar with the regular [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=arcanecode.com&#038;blog=340781&#038;post=2328&#038;subd=arcanecode&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>The company I work for, <a href="http://pragmaticworks.com/PragmaticWorksHome.aspx" target="_blank">Pragmatic Works</a>, makes a great tool called <a href="http://pragmaticworks.com/Products/Task-Factory.aspx" target="_blank">Task Factory</a>. It’s a set of transformations that plug into SQL Server Integration Services and provides a wealth of new controls you can use in your packages. One of these is the Advanced Derived Column Transformation. If you are familiar with the regular Derived Column transformation built into SSIS, you know that it can be painful to use if you have to create anything other than a very basic calculation. Every try typing something complex into that single row tiny little box? Egad. </p>
<p>The Task Factory Advanced Derived Column transform allows you to pop up a dialog and have true multi-line editing. In addition there are 180 addition functions to make your life easier. Which is actually the point of this whole post. </p>
<p>As a Business Intelligence developer, one of the things I have to do almost daily is convert a date data type to an integer. Most dates (at least in the US) are in Month / Day / Year format. Overseas the format is usually Day / Month / Year (which to me makes more sense). SQL Server Analysis Services loves integer based field, so a common practice is to store dates as an integer in YYYYMMDD format. </p>
<p>Converting a date to an integer using the derived column transform can be ugly. Here’s an example of a fairly common (although not the only) way to do it:</p>
<pre></pre>
<pre style="font-size:11px;font-family:consolas, &#039;margin:0;width:100%;background-color:#ffffff;">(DT_I4)((DT_WSTR,4)YEAR(MyDateColumn) + RIGHT(&quot;<span style="color:#8b0000;">00</span>&quot; + (DT_WSTR,2)MONTH(MyDateColumn),2) + RIGHT(&quot;<span style="color:#8b0000;">00</span>&quot; + (DT_WSTR,2)DAY(MyDateColumn),2))</pre>
<p>Task Factory makes this much easier. There is a ToChar function which converts columns or values to characters. This function allows you to pass in a format to convert to. Wrap all that in a ToInteger function and away you go. Check this out:</p>
<pre></pre>
<pre style="font-size:11px;font-family:consolas, &#039;margin:0;width:100%;background-color:#ffffff;">ToInteger(ToChar(MyDateColumn, &quot;<span style="color:#8b0000;">yyyyMMdd</span>&quot;))</pre>
<p>Much, much simpler. One thing, the case of the format is very important. It must be yyyyMMdd, otherwise it won’t work. If you want to extend this more, you can actually check for a null, and if it is null return a –1 (a common Id for a missing row) or another special integer to indicate a missing value, such as 19000101. </p>
<pre></pre>
<pre style="font-size:11px;font-family:consolas, &#039;margin:0;width:100%;background-color:#ffffff;">IIf(<span style="color:#0000ff;">IsNull</span>(MyDateColumn)
</pre>
<pre style="font-size:11px;font-family:consolas, &#039;margin:0;width:100%;background-color:#ffffff;">   , -1
</pre>
<pre style="font-size:11px;font-family:consolas, &#039;margin:0;width:100%;background-color:#ffffff;">   , ToInteger(ToChar(MyDateColumn, &quot;<span style="color:#8b0000;">yyyyMMdd</span>&quot;))
</pre>
<pre style="font-size:11px;font-family:consolas, &#039;margin:0;width:100%;background-color:#ffffff;">   )
</pre>
<pre style="font-size:11px;font-family:consolas, &#039;margin:0;width:100%;background-color:#ffffff;"></pre>
<p>Here we first check to see if the column is null, if so we return the missing value, else we return the date converted integer. And yes, you can do multi line code inside the Advanced Derived Column Transformation. </p>
<p>As you can see the Advanced Derived Column Transformation makes working with dates much, much easier than the standard derived column transformation. This is such a common need that, at the risk of sounding like an ad, I decided to blog about it so I can share this with all my clients in the future. </p>
<p>(Just to be clear, it’s not an ad, I was not asked to do this, nor did I receive any money for it. Mostly I did this post just so I could share the syntax when I start each project or training class.)</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/arcanecode.wordpress.com/2328/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/arcanecode.wordpress.com/2328/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=arcanecode.com&#038;blog=340781&#038;post=2328&#038;subd=arcanecode&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://arcanecode.com/2013/03/25/creating-a-data-warehouse-date-id-in-task-factory-advanced-derived-column-transformation/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/8436cd3ff437697b2608405422efa4da?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">arcanecode</media:title>
		</media:content>
	</item>
		<item>
		<title>I&#8217;m Speaking! SQL Saturday Nashville and PowerShell Saturday Atlanta</title>
		<link>http://arcanecode.com/2012/10/11/im-speaking-sql-saturday-nashville-and-powershell-saturday-atlanta/</link>
		<comments>http://arcanecode.com/2012/10/11/im-speaking-sql-saturday-nashville-and-powershell-saturday-atlanta/#comments</comments>
		<pubDate>Thu, 11 Oct 2012 22:15:00 +0000</pubDate>
		<dc:creator>arcanecode</dc:creator>
				<category><![CDATA[Business Intelligence]]></category>
		<category><![CDATA[Data Warehousing]]></category>
		<category><![CDATA[DW/BI]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[SQL Saturday]]></category>
		<category><![CDATA[SQL Server]]></category>

		<guid isPermaLink="false">https://arcanecode.wordpress.com/?p=2325</guid>
		<description><![CDATA[Just wanted to let folks know I’ll be doing presentations at two upcoming events. The first is SQL Saturday #145 in Nashville. That’s this weekend, October 13th. I’ll be giving my “Introduction to Data Warehousing / Business Intelligence” presentation. Here is the slide deck I’ll be using: introtodatawarehousing.pdf My second presentation will be October 27 [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=arcanecode.com&#038;blog=340781&#038;post=2325&#038;subd=arcanecode&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Just wanted to let folks know I’ll be doing presentations at two upcoming events. </p>
<p>The first is <a href="http://www.sqlsaturday.com/145/eventhome.aspx" target="_blank">SQL Saturday #145 in Nashville</a>. That’s this weekend, October 13th. I’ll be giving my “Introduction to Data Warehousing / Business Intelligence” presentation. Here is the slide deck I’ll be using: <a title="introtodatawarehousing.pdf" href="http://arcanecode.files.wordpress.com/2012/08/introtodatawarehousing.pdf">introtodatawarehousing.pdf</a></p>
<p>My second presentation will be October 27 in Atlanta at <a href="http://powershellsaturday.com/003/" target="_blank">PowerShell Saturday #003</a>. Yep, the PowerShell guys are taking the Saturday concept and kicking off a series of PowerShell Saturdays. This is only the third, but I see many more coming in the future. </p>
<p>At PowerShell Saturday I’ll be presenting “Make SQL Server Pop with PowerShell”. I’ll cover both the SMO and SQL Provider during this session. </p>
<p>Looks like it’ll be a busy October, but I’d hurry as both events are filling up so don’t wait and get registered now!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/arcanecode.wordpress.com/2325/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/arcanecode.wordpress.com/2325/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=arcanecode.com&#038;blog=340781&#038;post=2325&#038;subd=arcanecode&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://arcanecode.com/2012/10/11/im-speaking-sql-saturday-nashville-and-powershell-saturday-atlanta/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/8436cd3ff437697b2608405422efa4da?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">arcanecode</media:title>
		</media:content>
	</item>
		<item>
		<title>Intro to DW/BI at SQL Saturday #167 Columbus GA</title>
		<link>http://arcanecode.com/2012/09/08/intro-to-dwbi-at-sql-saturday-167-columbus-ga/</link>
		<comments>http://arcanecode.com/2012/09/08/intro-to-dwbi-at-sql-saturday-167-columbus-ga/#comments</comments>
		<pubDate>Sat, 08 Sep 2012 16:01:25 +0000</pubDate>
		<dc:creator>arcanecode</dc:creator>
				<category><![CDATA[Business Intelligence]]></category>
		<category><![CDATA[Data Warehousing]]></category>
		<category><![CDATA[SQL Saturday]]></category>

		<guid isPermaLink="false">https://arcanecode.wordpress.com/?p=2323</guid>
		<description><![CDATA[Today, September 8th 2012, I’m presenting at SQL Saturday #167 in Columbus, GA. My slides for this presentation can be found at: http://arcanecode.files.wordpress.com/2012/08/introtodatawarehousing.pdf The shortcuts from the slides are: SSAS – http://bit.ly/arcanessas SSIS – http://bit.ly/arcanessis SSRS – http://bit.ly/arcanessrs SharePoint BI – http://bit.ly/arcanespbi PowerPivot – http://bit.ly/arcanepivot PowerShell – http://bit.ly/arcaneps Free MS Books – http://bit.ly/freemsbooks &#160; Thanks [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=arcanecode.com&#038;blog=340781&#038;post=2323&#038;subd=arcanecode&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Today, September 8th 2012, I’m presenting at SQL Saturday #167 in Columbus, GA. My slides for this presentation can be found at:</p>
<p><a title="http://arcanecode.files.wordpress.com/2012/08/introtodatawarehousing.pdf" href="http://arcanecode.files.wordpress.com/2012/08/introtodatawarehousing.pdf">http://arcanecode.files.wordpress.com/2012/08/introtodatawarehousing.pdf</a></p>
<p>The shortcuts from the slides are:</p>
<ul>
<li>SSAS – <a href="http://bit.ly/arcanessas">http://bit.ly/arcanessas</a> </li>
<li>SSIS – <a href="http://bit.ly/arcanessis">http://bit.ly/arcanessis</a> </li>
<li>SSRS – <a href="http://bit.ly/arcanessrs">http://bit.ly/arcanessrs</a> </li>
<li>SharePoint BI – <a href="http://bit.ly/arcanespbi">http://bit.ly/arcanespbi</a> </li>
<li>PowerPivot – <a href="http://bit.ly/arcanepivot">http://bit.ly/arcanepivot</a> </li>
<li>PowerShell – <a href="http://bit.ly/arcaneps">http://bit.ly/arcaneps</a> </li>
<li>Free MS Books – <a href="http://bit.ly/freemsbooks">http://bit.ly/freemsbooks</a> </li>
</ul>
<p>&#160;</p>
<p>Thanks for attending!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/arcanecode.wordpress.com/2323/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/arcanecode.wordpress.com/2323/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=arcanecode.com&#038;blog=340781&#038;post=2323&#038;subd=arcanecode&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://arcanecode.com/2012/09/08/intro-to-dwbi-at-sql-saturday-167-columbus-ga/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/8436cd3ff437697b2608405422efa4da?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">arcanecode</media:title>
		</media:content>
	</item>
		<item>
		<title>devLink 2012&#8211;SSDT in VS2012</title>
		<link>http://arcanecode.com/2012/08/30/devlink-2012ssdt-in-vs2012/</link>
		<comments>http://arcanecode.com/2012/08/30/devlink-2012ssdt-in-vs2012/#comments</comments>
		<pubDate>Thu, 30 Aug 2012 12:41:57 +0000</pubDate>
		<dc:creator>arcanecode</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SSDT]]></category>
		<category><![CDATA[Visual Studio 2012]]></category>
		<category><![CDATA[SQL Server Data Tools]]></category>
		<category><![CDATA[VS2012]]></category>

		<guid isPermaLink="false">https://arcanecode.wordpress.com/?p=2321</guid>
		<description><![CDATA[Today I’m presenting SQL Server Data Tools in Visual Studio 2012. While the bulk of the information can be found in the blog posts over the last few weeks, I wanted to upload the slide deck. You’ll find it here: http://arcanecode.files.wordpress.com/2012/08/ssdtinvs2012devlink1.pdf<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=arcanecode.com&#038;blog=340781&#038;post=2321&#038;subd=arcanecode&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Today I’m presenting SQL Server Data Tools in Visual Studio 2012. While the bulk of the information can be found in the blog posts over the last few weeks, I wanted to upload the slide deck. You’ll find it here:</p>
<p><a title="http://arcanecode.files.wordpress.com/2012/08/ssdtinvs2012devlink1.pdf" href="http://arcanecode.files.wordpress.com/2012/08/ssdtinvs2012devlink1.pdf">http://arcanecode.files.wordpress.com/2012/08/ssdtinvs2012devlink1.pdf</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/arcanecode.wordpress.com/2321/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/arcanecode.wordpress.com/2321/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=arcanecode.com&#038;blog=340781&#038;post=2321&#038;subd=arcanecode&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://arcanecode.com/2012/08/30/devlink-2012ssdt-in-vs2012/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/8436cd3ff437697b2608405422efa4da?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">arcanecode</media:title>
		</media:content>
	</item>
		<item>
		<title>SQL Server Data Tools in Visual Studio 2012&#8211;Snapshots</title>
		<link>http://arcanecode.com/2012/08/30/sql-server-data-tools-in-visual-studio-2012snapshots/</link>
		<comments>http://arcanecode.com/2012/08/30/sql-server-data-tools-in-visual-studio-2012snapshots/#comments</comments>
		<pubDate>Thu, 30 Aug 2012 06:52:00 +0000</pubDate>
		<dc:creator>arcanecode</dc:creator>
				<category><![CDATA[SSDT]]></category>
		<category><![CDATA[Visual Studio 2012]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Visual Studio Database Projects]]></category>

		<guid isPermaLink="false">https://arcanecode.wordpress.com/?p=2297</guid>
		<description><![CDATA[A new feature of SSDT, one not found in VS Database Projects, is the ability to do snapshots. A snapshot captures a copy of your database project as it exists at the time you take the snapshot. Once you have a snapshot there are several useful things you can do with&#160; them. Taking a snapshot [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=arcanecode.com&#038;blog=340781&#038;post=2297&#038;subd=arcanecode&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>A new feature of SSDT, one not found in VS Database Projects, is the ability to do <em>snapshots</em>. A snapshot captures a copy of your database project as it exists at the time you take the snapshot. Once you have a snapshot there are several useful things you can do with&#160; them. </p>
<p>Taking a snapshot is simplicity itself. Using the same project we’ve been using over the last few posts, right click on the project name, and pick “Snapshot Project” on the menu. </p>
<p><a href="http://arcanecode.files.wordpress.com/2012/08/snaghtml2b0695.png"><img style="background-image:none;margin:0 auto;padding-left:0;padding-right:0;display:block;float:none;padding-top:0;border-width:0;" title="SNAGHTML2b0695" border="0" alt="SNAGHTML2b0695" src="http://arcanecode.files.wordpress.com/2012/08/snaghtml2b0695_thumb.png?w=523&#038;h=223" width="523" height="223" /></a></p>
<p>&#160;</p>
<p>&#160;</p>
<p><a href="http://arcanecode.files.wordpress.com/2012/08/image19.png"><img style="background-image:none;margin:0 5px 0 0;padding-left:0;padding-right:0;display:inline;float:left;padding-top:0;border-width:0;" title="image" border="0" alt="image" align="left" src="http://arcanecode.files.wordpress.com/2012/08/image_thumb19.png?w=342&#038;h=98" width="342" height="98" /></a></p>
<p>Once you do, you’ll see a new file appear in the solution. You’ll be given the chance to rename it, but for this demo I’ll just take the default name. </p>
<p>&#160;</p>
<p>So now that you have a snapshot, how do you use it? Well let’s start with a database comparison. First, let’s make a change of some type to the database. I’m going to use the safe refactor (see my <a href="http://arcanecode.com/2012/08/21/sql-server-data-tools-in-visual-studio-2012safe-refactoring/" target="_blank">blog post</a> on this). I’m going to open the Employee table in the HumanResources schema and safe refactor the JobTitle column to become JobName. </p>
<p>With the file saved, let’s now decide we want to compare our current database project to what we’ve done in the past, namely our snapshot. The same tools we used for schema compare can also be used with a snapshot. </p>
<p>Right click on the snapshot and pick Schema Compare (for more info see my <a href="http://arcanecode.com/2012/08/28/sql-server-data-tools-in-visual-studio-2012schema-comparison/?preview=true" target="_blank">previous post</a>). When the schema compare window appears the snapshot will be in the source side. Over on the right, use the pick target to pick the current project, then click compare. You will now see the differences between your snapshot and your current project. </p>
<p><a href="http://arcanecode.files.wordpress.com/2012/08/image20.png"><img style="background-image:none;margin:0 auto;padding-left:0;padding-right:0;display:block;float:none;padding-top:0;border-width:0;" title="image" border="0" alt="image" src="http://arcanecode.files.wordpress.com/2012/08/image_thumb20.png?w=544&#038;h=444" width="544" height="444" /></a></p>
<p>&#160;</p>
<p>So looking at differences is nice, but what if you want to dig in and see the entire snapshot? If you’ll notice, the snapshot is created as a <em>dacpac</em> file. If you happened to notice in the earlier post on <a href="http://arcanecode.com/2012/08/02/sql-server-data-tools-in-visual-studio-2012importing-a-database/" target="_blank">creating an SSDT project</a>, in addition to importing from an existing database, we also have the option to import from a dacpac file. </p>
<p>Right click on the solution, and pick Add, New Project. </p>
<p><a href="http://arcanecode.files.wordpress.com/2012/08/image21.png"><img style="background-image:none;margin:0 auto;padding-left:0;padding-right:0;display:block;float:none;padding-top:0;border-width:0;" title="image" border="0" alt="image" src="http://arcanecode.files.wordpress.com/2012/08/image_thumb21.png?w=634&#038;h=401" width="634" height="401" /></a></p>
<p>Now pick a new SSDT project and give it a name. I’m going to name mine after the snapshot. Now right click on the project, and pick Import. then pick “Data-tier Application (*.dacpac). </p>
<p><a href="http://arcanecode.files.wordpress.com/2012/08/image22.png"><img style="background-image:none;margin:0 auto;padding-left:0;padding-right:0;display:block;float:none;padding-top:0;border-width:0;" title="image" border="0" alt="image" src="http://arcanecode.files.wordpress.com/2012/08/image_thumb22.png?w=637&#038;h=139" width="637" height="139" /></a></p>
<p>Now navigate to the snapshot dacpac file you created and import it. (Hint, to find out where it’s at, before you start the import right click on the snapshot file, and pick properties. One of the properties is “FullPath”, it will hold the full path / file name of the snapshot.)</p>
<p><a href="http://arcanecode.files.wordpress.com/2012/08/snaghtml42aae0.png"><img style="background-image:none;margin:0 auto;padding-left:0;padding-right:0;display:block;float:none;padding-top:0;border-width:0;" title="SNAGHTML42aae0" border="0" alt="SNAGHTML42aae0" src="http://arcanecode.files.wordpress.com/2012/08/snaghtml42aae0_thumb.png?w=559&#038;h=401" width="559" height="401" /></a></p>
<p>&#160;</p>
<p><a href="http://arcanecode.files.wordpress.com/2012/08/image23.png"><img style="background-image:none;margin:0 5px 0 0;padding-left:0;padding-right:0;display:inline;float:left;padding-top:0;border-width:0;" title="image" border="0" alt="image" align="left" src="http://arcanecode.files.wordpress.com/2012/08/image_thumb23.png?w=253&#038;h=534" width="253" height="534" /></a></p>
<p>Once you click start, your new project will have an exact copy of your project at the time the snapshot was created. </p>
<p>Move down the AdvWorks_20120821_07-19-43 project tree and open up the Human Resources schema, then the Employee table in both projects. Assuming you were following along you will now see the snapshot as the Job field as JobTitle, the name prior to the change. </p>
<p>Within our AdvWorks project, also navigate down to the Employees table, and you’ll see it has the new name of JobName for the job column. </p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p>While snapshots will capture versions of your database over time, be aware they are not a substitute for good source code control. Snapshots are manually created, and are part of the project. Source control will capture each version upon check in, but more importantly serves as a good back up. </p>
<p>Snapshots can also be useful when asking for help. Simply take a snapshot and e-mail it to your friend. They can simply import it and create a copy of your project. Much easier than trying to zip up the entire project and mail it around. </p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/arcanecode.wordpress.com/2297/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/arcanecode.wordpress.com/2297/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=arcanecode.com&#038;blog=340781&#038;post=2297&#038;subd=arcanecode&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://arcanecode.com/2012/08/30/sql-server-data-tools-in-visual-studio-2012snapshots/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/8436cd3ff437697b2608405422efa4da?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">arcanecode</media:title>
		</media:content>

		<media:content url="http://arcanecode.files.wordpress.com/2012/08/snaghtml2b0695_thumb.png" medium="image">
			<media:title type="html">SNAGHTML2b0695</media:title>
		</media:content>

		<media:content url="http://arcanecode.files.wordpress.com/2012/08/image_thumb19.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://arcanecode.files.wordpress.com/2012/08/image_thumb20.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://arcanecode.files.wordpress.com/2012/08/image_thumb21.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://arcanecode.files.wordpress.com/2012/08/image_thumb22.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://arcanecode.files.wordpress.com/2012/08/snaghtml42aae0_thumb.png" medium="image">
			<media:title type="html">SNAGHTML42aae0</media:title>
		</media:content>

		<media:content url="http://arcanecode.files.wordpress.com/2012/08/image_thumb23.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
		<item>
		<title>devLink 2012&#8211;Intro to Data Warehousing / Business Intelligence</title>
		<link>http://arcanecode.com/2012/08/29/devlink-2012intro-to-data-warehousing-business-intelligence/</link>
		<comments>http://arcanecode.com/2012/08/29/devlink-2012intro-to-data-warehousing-business-intelligence/#comments</comments>
		<pubDate>Wed, 29 Aug 2012 17:52:31 +0000</pubDate>
		<dc:creator>arcanecode</dc:creator>
				<category><![CDATA[Business Intelligence]]></category>
		<category><![CDATA[Data Warehousing]]></category>
		<category><![CDATA[devLink]]></category>

		<guid isPermaLink="false">https://arcanecode.wordpress.com/?p=2316</guid>
		<description><![CDATA[Today I’m presenting at devLink 2012. My slides for this presentation can be found at: http://arcanecode.files.wordpress.com/2012/08/introtodatawarehousing.pdf The shortcuts from the slides are: SSAS – http://bit.ly/arcanessas SSIS – http://bit.ly/arcanessis SSRS – http://bit.ly/arcanessrs SharePoint BI – http://bit.ly/arcanespbi PowerPivot – http://bit.ly/arcanepivot PowerShell – http://bit.ly/arcaneps Free MS Books – http://bit.ly/freemsbooks<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=arcanecode.com&#038;blog=340781&#038;post=2316&#038;subd=arcanecode&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Today I’m presenting at devLink 2012. My slides for this presentation can be found at:</p>
<p><a title="http://arcanecode.files.wordpress.com/2012/08/introtodatawarehousing.pdf" href="http://arcanecode.files.wordpress.com/2012/08/introtodatawarehousing.pdf">http://arcanecode.files.wordpress.com/2012/08/introtodatawarehousing.pdf</a></p>
<p>The shortcuts from the slides are:</p>
<ul>
<li>SSAS – <a href="http://bit.ly/arcanessas">http://bit.ly/arcanessas</a></li>
<li>SSIS – <a href="http://bit.ly/arcanessis">http://bit.ly/arcanessis</a></li>
<li>SSRS – <a href="http://bit.ly/arcanessrs">http://bit.ly/arcanessrs</a></li>
<li>SharePoint BI – <a href="http://bit.ly/arcanespbi">http://bit.ly/arcanespbi</a></li>
<li>PowerPivot – <a href="http://bit.ly/arcanepivot">http://bit.ly/arcanepivot</a></li>
<li>PowerShell – <a href="http://bit.ly/arcaneps">http://bit.ly/arcaneps</a></li>
<li>Free MS Books – <a href="http://bit.ly/freemsbooks">http://bit.ly/freemsbooks</a> </li>
</ul>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/arcanecode.wordpress.com/2316/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/arcanecode.wordpress.com/2316/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=arcanecode.com&#038;blog=340781&#038;post=2316&#038;subd=arcanecode&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://arcanecode.com/2012/08/29/devlink-2012intro-to-data-warehousing-business-intelligence/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/8436cd3ff437697b2608405422efa4da?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">arcanecode</media:title>
		</media:content>
	</item>
		<item>
		<title>SQL Server Data Tools in Visual Studio 2012&#8211;Schema Comparison</title>
		<link>http://arcanecode.com/2012/08/28/sql-server-data-tools-in-visual-studio-2012schema-comparison/</link>
		<comments>http://arcanecode.com/2012/08/28/sql-server-data-tools-in-visual-studio-2012schema-comparison/#comments</comments>
		<pubDate>Tue, 28 Aug 2012 07:48:00 +0000</pubDate>
		<dc:creator>arcanecode</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SSDT]]></category>
		<category><![CDATA[Visual Studio 2012]]></category>
		<category><![CDATA[Visual Studio Database Projects]]></category>

		<guid isPermaLink="false">https://arcanecode.wordpress.com/?p=2281</guid>
		<description><![CDATA[A feature carried over, but improved upon, from Visual Studio Database Projects is the Schema Comparison tool. The tool allows you to compare one database to another, a database to your project (or vice versa). It will also allow you to do comparisons between dacpacs and projects or databases (or them to dacpacs). Doing one [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=arcanecode.com&#038;blog=340781&#038;post=2281&#038;subd=arcanecode&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>A feature carried over, but improved upon, from Visual Studio Database Projects is the Schema Comparison tool. The tool allows you to compare one database to another, a database to your project (or vice versa). It will also allow you to do comparisons between dacpacs and projects or databases (or them to dacpacs). </p>
<p>Doing one is pretty simple. We’ll keep using the project we’ve been using in previous lessons. For today’s example I’ve done a <a href="http://arcanecode.com/2012/08/21/sql-server-data-tools-in-visual-studio-2012safe-refactoring/" target="_blank">safe refactor</a> on the JobTitle column in the HumanResources.Employee table, renaming it to JobName. I have also added a table and view to the dbo schema. For your example simply rename something in your project. After you make the changes, <em>don’t publish them!</em> We need something different for this example.</p>
<p>To kick off the schema compare, go to the SQL menu, then pick Schema Compare, New Schema Comparison. The dialog will be mostly empty, we’ll start with the upper portion. </p>
<p><a href="http://arcanecode.files.wordpress.com/2012/08/snaghtml5a136e5.png"><img style="background-image:none;border-bottom:0;border-left:0;margin:0 auto;padding-left:0;padding-right:0;display:block;float:none;border-top:0;border-right:0;padding-top:0;" title="SNAGHTML5a136e5" border="0" alt="SNAGHTML5a136e5" src="http://arcanecode.files.wordpress.com/2012/08/snaghtml5a136e5_thumb.png?w=633&#038;h=150" width="633" height="150" /></a></p>
<p>As you see, on the left we hit the drop down and will pick Select Source. </p>
<p><a href="http://arcanecode.files.wordpress.com/2012/08/snaghtml5a33178.png"><img style="background-image:none;border-bottom:0;border-left:0;margin:0 auto;padding-left:0;padding-right:0;display:block;float:none;border-top:0;border-right:0;padding-top:0;" title="SNAGHTML5a33178" border="0" alt="SNAGHTML5a33178" src="http://arcanecode.files.wordpress.com/2012/08/snaghtml5a33178_thumb.png?w=390&#038;h=359" width="390" height="359" /></a></p>
<p>Here you have three choices. The top is to pick a project as your source. The second will let you pick an existing database as a source. The final choice will allow you to pick a dacpac file. For this example, we’ll pick the database that we created from our AdvWorks project, one prior to the changes you just made. </p>
<p>On the right, hit the drop down and for the target pick your AdvWorks project. Now click the Compare button in the upper left. SSDT will do the comparison and populate a dialog with the results. </p>
<p><a href="http://arcanecode.files.wordpress.com/2012/08/image18.png"><img style="background-image:none;border-bottom:0;border-left:0;margin:0 auto;padding-left:0;padding-right:0;display:block;float:none;border-top:0;border-right:0;padding-top:0;" title="image" border="0" alt="image" src="http://arcanecode.files.wordpress.com/2012/08/image_thumb18.png?w=462&#038;h=470" width="462" height="470" /></a></p>
<p>In the upper half you will see a list of all the changes found. If you click on a change, the Object Definition area in the lower half populates with the code that creates the objects, and highlights the differences. In this example you’ll see that our source system has the JobTitle column, whereas the project on the right has our change to JobName. </p>
<p>The check boxes allow you to select or deselect individual changes. For example, you could go to the upper half which is designated to delete the ArcaneCode table and view and uncheck them. Then when you apply the changes these would be left untouched. </p>
<p>If you have a lot of changes you wish to omit, you can buik apply the exclusion (and likewise the inclusion) of files. Right click on a grouping (here the groups are changes and deletes), in the popup menu you can choose to Include All or Exclude All.</p>
<p>To apply the changes, simply click the Update button. </p>
<p><a href="http://arcanecode.files.wordpress.com/2012/08/snaghtml5b39106.png"><img style="background-image:none;border-bottom:0;border-left:0;margin:0 5px 0 0;padding-left:0;padding-right:0;display:inline;float:left;border-top:0;border-right:0;padding-top:0;" title="SNAGHTML5b39106" border="0" alt="SNAGHTML5b39106" align="left" src="http://arcanecode.files.wordpress.com/2012/08/snaghtml5b39106_thumb.png?w=262&#038;h=148" width="262" height="148" /></a>You can choose how to group the comparisons findings. In the schema comparisons toolbar, you can choose to group by Action (the default), by the Schemas, or by Type (types being tables, views, etc). </p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p>You could have a situation that could result in data loss, for example the deletion of a table. By default SSDT will block any changes that will result in data loss in the target. Your target, however, might be a test database in which you don’t care if you lose data. There may also be other options you wish to override. </p>
<p>To see the options for applying updates, click on the gear immediately to the left of the grouping toolbar button. </p>
<p><a href="http://arcanecode.files.wordpress.com/2012/08/snaghtml5b8182f.png"><img style="background-image:none;border-bottom:0;border-left:0;margin:0 auto;padding-left:0;padding-right:0;display:block;float:none;border-top:0;border-right:0;padding-top:0;" title="SNAGHTML5b8182f" border="0" alt="SNAGHTML5b8182f" src="http://arcanecode.files.wordpress.com/2012/08/snaghtml5b8182f_thumb.png?w=492&#038;h=369" width="492" height="369" /></a></p>
<p>Here you can see a vast list of options available to you, that will affect the way in which SSDT applies updates to the target. You can see the “Block on possible data loss” option under the mouse, and could uncheck it to force your changes. There’s a lot of options here, so scroll through the list to see what other options you might be interested in. </p>
<p>Between the dropdowns for source and target is a little double arrow symbol. Click it will swap the source and target. Do it now, so the database now becomes the target and the project becomes the source. Now run the Compare again. </p>
<p><a href="http://arcanecode.files.wordpress.com/2012/08/snaghtml5bcadd9.png"><img style="background-image:none;border-bottom:0;border-left:0;margin:0 5px 0 0;padding-left:0;padding-right:0;display:inline;float:left;border-top:0;border-right:0;padding-top:0;" title="SNAGHTML5bcadd9" border="0" alt="SNAGHTML5bcadd9" align="left" src="http://arcanecode.files.wordpress.com/2012/08/snaghtml5bcadd9_thumb.png?w=239&#038;h=100" width="239" height="100" /></a>You should now see the button between the Update and Options buttons become enabled. This is the Generate Script button, and becomes active when the target is a database. </p>
<p>&#160;</p>
<p>Click it an a new window will appear with all the T-SQL that will change the target database to make it in sync with the project. </p>
<p>Let me stress something. This is not the way you should apply changes to your databases! The <a href="http://arcanecode.com/2012/08/07/sql-server-data-tools-in-visual-studio-2012publish-database-profile/" target="_blank">publish</a> feature is the proper way to do that, in it are options to generate incremental updates. </p>
<p>This option is more for times when you have a test database you want to quickly get in sync, but for whatever reasons don’t want to create a full publish profile. </p>
<p>The Schema Comparison tool is surprisingly useful. A true story, I was working on a project one time that had considerable changes to an existing database. It was a short term project, so not a lot of time. In theory the source database was supposed to be left unchanged. Note I say “in theory”. </p>
<p>Bright and early Monday morning the very new to the job DBA comes to us and says “Oh by the way we had some issues over the weekend so I had to apply a bunch of changes.” When we asked for his scripts he just shrugged and said “I didn’t keep any of that junk. The changes are in the database just go get ‘em.” And with that wandered away, presumably to provide more sunshine to the lives of other dev teams. </p>
<p>At one time this would have been a major set-back. Fortunately the Schema Comparison tool quickly brought our project up to date. We were able to see the database changes before we applied them to our project, and in a few cases exclude the automatic changes and instead make them manually in our project. </p>
<p>Play around with the Schema Comparison tool, you can run it without actually applying changes. Knowing how to use it will help you on that fateful day when a new dba spreads a little sunshine into your own life. </p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/arcanecode.wordpress.com/2281/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/arcanecode.wordpress.com/2281/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=arcanecode.com&#038;blog=340781&#038;post=2281&#038;subd=arcanecode&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://arcanecode.com/2012/08/28/sql-server-data-tools-in-visual-studio-2012schema-comparison/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/8436cd3ff437697b2608405422efa4da?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">arcanecode</media:title>
		</media:content>

		<media:content url="http://arcanecode.files.wordpress.com/2012/08/snaghtml5a136e5_thumb.png" medium="image">
			<media:title type="html">SNAGHTML5a136e5</media:title>
		</media:content>

		<media:content url="http://arcanecode.files.wordpress.com/2012/08/snaghtml5a33178_thumb.png" medium="image">
			<media:title type="html">SNAGHTML5a33178</media:title>
		</media:content>

		<media:content url="http://arcanecode.files.wordpress.com/2012/08/image_thumb18.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://arcanecode.files.wordpress.com/2012/08/snaghtml5b39106_thumb.png" medium="image">
			<media:title type="html">SNAGHTML5b39106</media:title>
		</media:content>

		<media:content url="http://arcanecode.files.wordpress.com/2012/08/snaghtml5b8182f_thumb.png" medium="image">
			<media:title type="html">SNAGHTML5b8182f</media:title>
		</media:content>

		<media:content url="http://arcanecode.files.wordpress.com/2012/08/snaghtml5bcadd9_thumb.png" medium="image">
			<media:title type="html">SNAGHTML5bcadd9</media:title>
		</media:content>
	</item>
		<item>
		<title>SQL Server Data Tools in Visual Studio 2012&#8211;Customizing the Table Designer Layout</title>
		<link>http://arcanecode.com/2012/08/23/sql-server-data-tools-in-visual-studio-2012customizing-the-table-designer-layout/</link>
		<comments>http://arcanecode.com/2012/08/23/sql-server-data-tools-in-visual-studio-2012customizing-the-table-designer-layout/#comments</comments>
		<pubDate>Thu, 23 Aug 2012 06:28:00 +0000</pubDate>
		<dc:creator>arcanecode</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SSDT]]></category>
		<category><![CDATA[Visual Studio 2012]]></category>
		<category><![CDATA[Visual Studio Database Projects]]></category>

		<guid isPermaLink="false">https://arcanecode.wordpress.com/?p=2264</guid>
		<description><![CDATA[With this post I want to show you a few of the nice shortcuts provided to you in Visual Studio SSDT for quickly customizing the layout of your designers. A few of the items only apply to the table designer, but many apply to other windows within Visual Studio, no matter what project type is [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=arcanecode.com&#038;blog=340781&#038;post=2264&#038;subd=arcanecode&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>With this post I want to show you a few of the nice shortcuts provided to you in Visual Studio SSDT for quickly customizing the layout of your designers. A few of the items only apply to the table designer, but many apply to other windows within Visual Studio, no matter what project type is being hosted. </p>
<p><a href="http://arcanecode.files.wordpress.com/2012/08/image12.png"><img style="background-image:none;border-bottom:0;border-left:0;margin:0 auto;padding-left:0;padding-right:0;display:block;float:none;border-top:0;border-right:0;padding-top:0;" title="image" border="0" alt="image" src="http://arcanecode.files.wordpress.com/2012/08/image_thumb12.png?w=556&#038;h=303" width="556" height="303" /></a></p>
<p>Number 1 points to the pane swap button. Clicking it will simply swap the positions of the grid and T-SQL windows, like so:</p>
<p><a href="http://arcanecode.files.wordpress.com/2012/08/image13.png"><img style="background-image:none;border-bottom:0;border-left:0;margin:0 auto;padding-left:0;padding-right:0;display:block;float:none;border-top:0;border-right:0;padding-top:0;" title="image" border="0" alt="image" src="http://arcanecode.files.wordpress.com/2012/08/image_thumb13.png?w=453&#038;h=301" width="453" height="301" /></a></p>
<p>The double bar pointed to by number 2 is the resizing handle. Click and drag to adjust the amount of space used by either pane. </p>
<p><a href="http://arcanecode.files.wordpress.com/2012/08/image14.png"><img style="background-image:none;border-bottom:0;border-left:0;margin:0 auto;padding-left:0;padding-right:0;display:block;float:none;border-top:0;border-right:0;padding-top:0;" title="image" border="0" alt="image" src="http://arcanecode.files.wordpress.com/2012/08/image_thumb14.png?w=453&#038;h=314" width="453" height="314" /></a></p>
<p>Note the change of the cursor shape when it’s hovered over the double bars. </p>
<p>There are three buttons pointed to by number 3. The middle one is the default, and indicates you want to split the panes horizontally. If you click the left most of these 3, it will split the panes vertically. </p>
<p><a href="http://arcanecode.files.wordpress.com/2012/08/image15.png"><img style="background-image:none;border-bottom:0;border-left:0;margin:0 auto;padding-left:0;padding-right:0;display:block;float:none;border-top:0;border-right:0;padding-top:0;" title="image" border="0" alt="image" src="http://arcanecode.files.wordpress.com/2012/08/image_thumb15.png?w=444&#038;h=397" width="444" height="397" /></a></p>
<p>Vertical mode is really nice when you have a super wide screen monitor. As you can see, the three buttons have now shifted to the bottom center of the screen, next to the mouse in the above image. </p>
<p>What if you are working on a really small screen, and don’t even have enough real estate to work comfortably with any size split? Well that’s where the right (or bottom if vertically split) button comes in. Click it to shift to tabbed mode. (Note, I suggest you shift back to the default horizontal split first, otherwise the tabs will be on the right instead of the bottom and not quite as easy to use). </p>
<p><a href="http://arcanecode.files.wordpress.com/2012/08/image16.png"><img style="background-image:none;border-bottom:0;border-left:0;margin:0 auto;padding-left:0;padding-right:0;display:block;float:none;border-top:0;border-right:0;padding-top:0;" title="image" border="0" alt="image" src="http://arcanecode.files.wordpress.com/2012/08/image_thumb16.png?w=459&#038;h=245" width="459" height="245" /></a></p>
<p>The last button, number 4, is for the T-SQL pane. It’s also found in almost all code editor windows in Visual Studio. Using it you can split the code view so you can see two different sections of you code at the same time. </p>
<p><a href="http://arcanecode.files.wordpress.com/2012/08/image17.png"><img style="background-image:none;border-bottom:0;border-left:0;margin:0 auto;padding-left:0;padding-right:0;display:block;float:none;border-top:0;border-right:0;padding-top:0;" title="image" border="0" alt="image" src="http://arcanecode.files.wordpress.com/2012/08/image_thumb17.png?w=453&#038;h=218" width="453" height="218" /></a></p>
<p>Great for working with especially large code bases. And this split should exist in any text editor, not just the designer. Whether it’s straight T-SQL, VB.Net, C++, F#, or C# it should work for you.</p>
<p>For a typical desktop user, you’ll probably set these once and forget. But for folks like me who travel a lot, these are a real blessing. When I’m at home, with my laptop hooked up to my 25inch wide screen monitor, I can quickly shift to split screen vertical mode to take advantage of all that width. </p>
<p>When I’m on the road though, working on my laptops small screen (12 inches), I can shift back to horizontal mode, or more often (for me) tabbed mode, for doing my work. </p>
<p>Experiment with different layouts, and find out what works best for you!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/arcanecode.wordpress.com/2264/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/arcanecode.wordpress.com/2264/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=arcanecode.com&#038;blog=340781&#038;post=2264&#038;subd=arcanecode&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://arcanecode.com/2012/08/23/sql-server-data-tools-in-visual-studio-2012customizing-the-table-designer-layout/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/8436cd3ff437697b2608405422efa4da?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">arcanecode</media:title>
		</media:content>

		<media:content url="http://arcanecode.files.wordpress.com/2012/08/image_thumb12.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://arcanecode.files.wordpress.com/2012/08/image_thumb13.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://arcanecode.files.wordpress.com/2012/08/image_thumb14.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://arcanecode.files.wordpress.com/2012/08/image_thumb15.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://arcanecode.files.wordpress.com/2012/08/image_thumb16.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://arcanecode.files.wordpress.com/2012/08/image_thumb17.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
		<item>
		<title>SQL Server Data Tools in Visual Studio 2012&#8211;Safe Refactoring</title>
		<link>http://arcanecode.com/2012/08/21/sql-server-data-tools-in-visual-studio-2012safe-refactoring/</link>
		<comments>http://arcanecode.com/2012/08/21/sql-server-data-tools-in-visual-studio-2012safe-refactoring/#comments</comments>
		<pubDate>Tue, 21 Aug 2012 06:14:00 +0000</pubDate>
		<dc:creator>arcanecode</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SSDT]]></category>
		<category><![CDATA[Visual Studio 2012]]></category>
		<category><![CDATA[Visual Studio Database Projects]]></category>

		<guid isPermaLink="false">https://arcanecode.wordpress.com/?p=2250</guid>
		<description><![CDATA[With Visual Studio Database Projects (VSDB), you entered into Safe Refactoring mode through the Schema View window. But in SSDT, the Schema View window no longer exists. So how the heck do you do it?? Well first off, let’s define safe refactoring for those who may not have been familiar with the feature in VSDB. [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=arcanecode.com&#038;blog=340781&#038;post=2250&#038;subd=arcanecode&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>With Visual Studio Database Projects (VSDB), you entered into Safe Refactoring mode through the Schema View window. But in SSDT, the Schema View window no longer exists. So how the heck do you do it??</p>
<p>Well first off, let’s define safe refactoring for those who may not have been familiar with the feature in VSDB. It allowed you to right click on a column name, and pick rename. You could then enter a new name, and hit the preview button. Visual Studio would comb through your source code and find every occurrence of that column name for that table and show it to you. If you clicked OK, Visual Studio would then go through and make the change everywhere for you, ensuring you didn’t miss anything. </p>
<p>Before we can do a safe refactor, we need to have something to refactor, and to test with. For this demo, we’ll create a simple view to read the dbo.ArcaneCode table we created in the previous post. Since there is no folder in the dbo schema for views, we’ll first have to create it. </p>
<p>Still working with our AdvWorks sample, open the dbo folder. Right click on it, and pick Add, Folder. Name the folder Views. Let me interject that strictly speaking, this isn’t a requirement. We could have placed the new view source file we’re about to create anywhere. But keeping a file/folder structure consistent with this and other SSDT projects will make maintenance far easier. </p>
<p>OK, once the folder is there, right click on it, again pick add, only this time pick a new View. Name the view dbo.vwArcaneCode. </p>
<div id="codeSnippetWrapper">
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;margin:0;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0;"><span style="color:#0000ff;">CREATE</span> <span style="color:#0000ff;">VIEW</span> [dbo].[vwArcaneCode] <span style="color:#0000ff;">AS</span> <br />  <span style="color:#0000ff;">SELECT</span> [BlogUrl], [BlogAuthor]<br />    <span style="color:#0000ff;">FROM</span> dbo.ArcaneCode</pre>
<p></div>
<p>And save it. Now return to the table designer for the new ArcaneCode table. </p>
<p>Let’s decide we don’t like the name BlogUrl, and we’d rather call it BlogSite. Well, first we could try putting our cursor into the T-SQL area, and just typing over BlogUrl with BlogSite. What happens? </p>
<p><a href="http://arcanecode.files.wordpress.com/2012/08/snaghtmlbdd349.png"><img style="background-image:none;border-bottom:0;border-left:0;margin:0 auto;padding-left:0;padding-right:0;display:block;float:none;border-top:0;border-right:0;padding-top:0;" title="SNAGHTMLbdd349" border="0" alt="SNAGHTMLbdd349" src="http://arcanecode.files.wordpress.com/2012/08/snaghtmlbdd349_thumb.png?w=451&#038;h=315" width="451" height="315" /></a></p>
<p>Well, as you can see above, the designer on the upper half changes, but the column name in Create Index did not update. Not nearly what we wanted. </p>
<p>Let’s start over. Restore the name in the T-SQL area back to BlogUrl. Now go into the grid at the top, and change it there. </p>
<p><a href="http://arcanecode.files.wordpress.com/2012/08/snaghtmlc00ed2.png"><img style="background-image:none;border-bottom:0;border-left:0;margin:0 auto;padding-left:0;padding-right:0;display:block;float:none;border-top:0;border-right:0;padding-top:0;" title="SNAGHTMLc00ed2" border="0" alt="SNAGHTMLc00ed2" src="http://arcanecode.files.wordpress.com/2012/08/snaghtmlc00ed2_thumb.png?w=486&#038;h=328" width="486" height="328" /></a></p>
<p>Hey, that’s better! Once we tabbed out of the Name column (or clicked elsewhere) it changed the name in all the locations in the T-SQL area. Just what we wanted!</p>
<p><strong>Or is it?</strong></p>
<p>Remember, we also used this column in the vwArcaneCode. Go take a look at its code. </p>
<p><a href="http://arcanecode.files.wordpress.com/2012/08/image9.png"><img style="background-image:none;border-bottom:0;border-left:0;margin:0 auto;padding-left:0;padding-right:0;display:block;float:none;border-top:0;border-right:0;padding-top:0;" title="image" border="0" alt="image" src="http://arcanecode.files.wordpress.com/2012/08/image_thumb9.png?w=337&#038;h=82" width="337" height="82" /></a></p>
<p>As you can see, it remained unchanged. Even worse, there’s now a big red squiggly under the BlogUrl name, indicating we have now created an error in our project. Sigh. OK, one more time. </p>
<p>Go back to the table designer, and reset the name back to BlogUrl. Now we’re finally ready to do this the right way. </p>
<p>Put your cursor somewhere in the column name in the T-SQL area, then right click on the column name. Note, this will not work if you try it in the grid area at the top! </p>
<p>From the menu, pick Refactor, Rename. </p>
<p><a href="http://arcanecode.files.wordpress.com/2012/08/image10.png"><img style="background-image:none;border-bottom:0;border-left:0;margin:0 auto;padding-left:0;padding-right:0;display:block;float:none;border-top:0;border-right:0;padding-top:0;" title="image" border="0" alt="image" src="http://arcanecode.files.wordpress.com/2012/08/image_thumb10.png?w=549&#038;h=163" width="549" height="163" /></a></p>
<p>You’ll now see a dialog appear, giving you a place to enter a new name. Change the name to BlogSite, and make sure the Preview Changes is checked on, then click OK.</p>
<p><a href="http://arcanecode.files.wordpress.com/2012/08/snaghtmlc89a4f.png"><img style="background-image:none;border-bottom:0;border-left:0;margin:0 auto;padding-left:0;padding-right:0;display:block;float:none;border-top:0;border-right:0;padding-top:0;" title="SNAGHTMLc89a4f" border="0" alt="SNAGHTMLc89a4f" src="http://arcanecode.files.wordpress.com/2012/08/snaghtmlc89a4f_thumb.png?w=465&#038;h=186" width="465" height="186" /></a></p>
<p>Once you do, a new window will appear. It will show you everywhere the change would be made. </p>
<p><a href="http://arcanecode.files.wordpress.com/2012/08/snaghtmlca7716.png"><img style="background-image:none;border-bottom:0;border-left:0;margin:0 auto;padding-left:0;padding-right:0;display:block;float:none;border-top:0;border-right:0;padding-top:0;" title="SNAGHTMLca7716" border="0" alt="SNAGHTMLca7716" src="http://arcanecode.files.wordpress.com/2012/08/snaghtmlca7716_thumb.png?w=586&#038;h=294" width="586" height="294" /></a></p>
<p>Looking at the window,&#160; the upper part shows you all the files and the line of code in the file for which a change would be made. If you click on a line, the new version of the code will appear in the lower window. Ahh, there’s the view, and you can see it is being shown with the new change that will be made. </p>
<p>Note that no change has occurred as of yet. You must click the Apply button for anything to actually change. You can also click Cancel to abandon the change. </p>
<p>If you need to know everywhere a column name is used, but don’t want to change it, there’s an easy way to do that too. When we right clicked on the column name and picked Refactor, well a few menu options down was another option called “Find All References”. Picking that will populate a window in your Visual Studio environment. </p>
<p><a href="http://arcanecode.files.wordpress.com/2012/08/image11.png"><img style="background-image:none;border-bottom:0;border-left:0;margin:0 auto;padding-left:0;padding-right:0;display:block;float:none;border-top:0;border-right:0;padding-top:0;" title="image" border="0" alt="image" src="http://arcanecode.files.wordpress.com/2012/08/image_thumb11.png?w=815&#038;h=90" width="815" height="90" /></a></p>
<p>When you click on a line in the above window, your central display in Visual Studio changes to now show the file you clicked on in this window.</p>
<p>There you go, you can now not only safely refactor column names in Visual Studio 2012 SSDT, but you can also find all references to that column within your project. </p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/arcanecode.wordpress.com/2250/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/arcanecode.wordpress.com/2250/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=arcanecode.com&#038;blog=340781&#038;post=2250&#038;subd=arcanecode&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://arcanecode.com/2012/08/21/sql-server-data-tools-in-visual-studio-2012safe-refactoring/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/8436cd3ff437697b2608405422efa4da?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">arcanecode</media:title>
		</media:content>

		<media:content url="http://arcanecode.files.wordpress.com/2012/08/snaghtmlbdd349_thumb.png" medium="image">
			<media:title type="html">SNAGHTMLbdd349</media:title>
		</media:content>

		<media:content url="http://arcanecode.files.wordpress.com/2012/08/snaghtmlc00ed2_thumb.png" medium="image">
			<media:title type="html">SNAGHTMLc00ed2</media:title>
		</media:content>

		<media:content url="http://arcanecode.files.wordpress.com/2012/08/image_thumb9.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://arcanecode.files.wordpress.com/2012/08/image_thumb10.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://arcanecode.files.wordpress.com/2012/08/snaghtmlc89a4f_thumb.png" medium="image">
			<media:title type="html">SNAGHTMLc89a4f</media:title>
		</media:content>

		<media:content url="http://arcanecode.files.wordpress.com/2012/08/snaghtmlca7716_thumb.png" medium="image">
			<media:title type="html">SNAGHTMLca7716</media:title>
		</media:content>

		<media:content url="http://arcanecode.files.wordpress.com/2012/08/image_thumb11.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
		<item>
		<title>SQL Server Data Tools in Visual Studio 2012&#8211;Table Designer&#8211;Other Objects</title>
		<link>http://arcanecode.com/2012/08/16/sql-server-data-tools-in-visual-studio-2012table-designerother-objects/</link>
		<comments>http://arcanecode.com/2012/08/16/sql-server-data-tools-in-visual-studio-2012table-designerother-objects/#comments</comments>
		<pubDate>Thu, 16 Aug 2012 06:36:00 +0000</pubDate>
		<dc:creator>arcanecode</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SSDT]]></category>
		<category><![CDATA[Visual Studio 2012]]></category>
		<category><![CDATA[Visual Studio Database Projects]]></category>

		<guid isPermaLink="false">https://arcanecode.wordpress.com/?p=2234</guid>
		<description><![CDATA[Above is the screen shot of where things were left at the end of the previous post. We had just added a new table and used the designer to create four columns, along with their data types. We also saw how we can edit the table in T-SQL and see updates in the designer’s grid [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=arcanecode.com&#038;blog=340781&#038;post=2234&#038;subd=arcanecode&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p><a href="http://arcanecode.files.wordpress.com/2012/08/image7.png"><img style="background-image:none;border-bottom:0;border-left:0;margin:0 auto;padding-left:0;padding-right:0;display:block;float:none;border-top:0;border-right:0;padding-top:0;" title="image" border="0" alt="image" src="http://arcanecode.files.wordpress.com/2012/08/image_thumb7.png?w=556&#038;h=303" width="556" height="303" /></a></p>
<p>Above is the screen shot of where things were left at the end of the previous post. We had just added a new table and used the designer to create four columns, along with their data types. We also saw how we can edit the table in T-SQL and see updates in the designer’s grid above. </p>
<p>But what’s all that stuff to the right of the grid? It would seem to list the various objects that would be associated with a table. In this case there’s only one, the unnamed Primary Key. But through this are we can also add new objects. </p>
<p>Let’s add a simple index. Right click on the Indexes (0) area. from the menu pick Add New, then for this example we’ll pick a standard Index.</p>
<p><a href="http://arcanecode.files.wordpress.com/2012/08/image8.png"><img style="background-image:none;border-bottom:0;border-left:0;margin:0 auto;padding-left:0;padding-right:0;display:block;float:none;border-top:0;border-right:0;padding-top:0;" title="image" border="0" alt="image" src="http://arcanecode.files.wordpress.com/2012/08/image_thumb8.png?w=506&#038;h=205" width="506" height="205" /></a></p>
<p>&#160;</p>
<p>When you do, a new index name appears below the Indexes (0) area, with a default name. </p>
<p><a href="http://arcanecode.files.wordpress.com/2012/08/snaghtmla8b905.png"><img style="background-image:none;border-bottom:0;border-left:0;margin:0 auto;padding-left:0;padding-right:0;display:block;float:none;border-top:0;border-right:0;padding-top:0;" title="SNAGHTMLa8b905" border="0" alt="SNAGHTMLa8b905" src="http://arcanecode.files.wordpress.com/2012/08/snaghtmla8b905_thumb.png?w=236&#038;h=96" width="236" height="96" /></a></p>
<p>Since this is going to be for the BlogUrl, I’m going to change the name to IX_ArcaneCode_BlogUrl. You’ll see the Indexes collection area has updated to reflect the new name, and the number in parenthesis has been updated to (1), to reflect the number of Indexes. </p>
<p>In the T-SQL area at the bottom, you’ll see some new T-SQL setup and ready for you to update. Here, all you have to do is change the [Column] to be the actual field name you wish to use in the index. In this case, [BlogUrl]. </p>
<p><a href="http://arcanecode.files.wordpress.com/2012/08/snaghtmlaa70bf.png"><img style="background-image:none;border-bottom:0;border-left:0;margin:0 auto;padding-left:0;padding-right:0;display:block;float:none;border-top:0;border-right:0;padding-top:0;" title="SNAGHTMLaa70bf" border="0" alt="SNAGHTMLaa70bf" src="http://arcanecode.files.wordpress.com/2012/08/snaghtmlaa70bf_thumb.png?w=552&#038;h=425" width="552" height="425" /></a></p>
<p>Think of the new designer as a combination of easy to use UI with a code generator. Creating other objects works just like you’ve seen here. You right click, pick what you want to add, and Visual Studio SSDT inserts the code template read for you to update. </p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/arcanecode.wordpress.com/2234/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/arcanecode.wordpress.com/2234/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=arcanecode.com&#038;blog=340781&#038;post=2234&#038;subd=arcanecode&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://arcanecode.com/2012/08/16/sql-server-data-tools-in-visual-studio-2012table-designerother-objects/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/8436cd3ff437697b2608405422efa4da?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">arcanecode</media:title>
		</media:content>

		<media:content url="http://arcanecode.files.wordpress.com/2012/08/image_thumb7.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://arcanecode.files.wordpress.com/2012/08/image_thumb8.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://arcanecode.files.wordpress.com/2012/08/snaghtmla8b905_thumb.png" medium="image">
			<media:title type="html">SNAGHTMLa8b905</media:title>
		</media:content>

		<media:content url="http://arcanecode.files.wordpress.com/2012/08/snaghtmlaa70bf_thumb.png" medium="image">
			<media:title type="html">SNAGHTMLaa70bf</media:title>
		</media:content>
	</item>
		<item>
		<title>SQL Server Data Tools in Visual Studio 2012&#8211;Table Designer</title>
		<link>http://arcanecode.com/2012/08/14/sql-server-data-tools-in-visual-studio-2012table-designer/</link>
		<comments>http://arcanecode.com/2012/08/14/sql-server-data-tools-in-visual-studio-2012table-designer/#comments</comments>
		<pubDate>Tue, 14 Aug 2012 06:18:00 +0000</pubDate>
		<dc:creator>arcanecode</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SSDT]]></category>
		<category><![CDATA[Visual Studio 2012]]></category>
		<category><![CDATA[Visual Studio Database Projects]]></category>

		<guid isPermaLink="false">https://arcanecode.wordpress.com/?p=2224</guid>
		<description><![CDATA[One of most noticeable enhancements to the data tools (over the previous database projects) is the table designer. Using the AdvWorks project we started in previous posts, let’s add a new table. Since the dbo schema has few tables, let’s add it there. Expand the&#160; dbo schema, right click on the Tables folder, right click [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=arcanecode.com&#038;blog=340781&#038;post=2224&#038;subd=arcanecode&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>One of most noticeable enhancements to the data tools (over the previous database projects) is the table designer. Using the AdvWorks project we started in previous posts, let’s add a new table. Since the dbo schema has few tables, let’s add it there. </p>
<p>Expand the&#160; dbo schema, right click on the Tables folder, right click and pick Add, Table as you can see in this illustration.</p>
<p><a href="http://arcanecode.files.wordpress.com/2012/08/snaghtml28a093.png"><img style="background-image:none;margin:0 auto;padding-left:0;padding-right:0;display:block;float:none;padding-top:0;border-width:0;" title="SNAGHTML28a093" border="0" alt="SNAGHTML28a093" src="http://arcanecode.files.wordpress.com/2012/08/snaghtml28a093_thumb.png?w=512&#038;h=371" width="512" height="371" /></a></p>
<p>Next you’ll be asked to confirm the type of object you wish to add, and what you want to name it. Ensure the “Table” object type is selected (the red arrow points it out below). Then, give your new table a good name. If you use multiple schemas in your database (and you should) then <em>get into the habit of always typing in the schema name before the table name, even if it’s the default schema</em>. This will prevent you from putting tables into the wrong schema, then having to clean up the mess later. </p>
<p><a href="http://arcanecode.files.wordpress.com/2012/08/snaghtml2ae15a.png"><img style="background-image:none;margin:0 auto;padding-left:0;padding-right:0;display:block;float:none;padding-top:0;border-width:0;" title="SNAGHTML2ae15a" border="0" alt="SNAGHTML2ae15a" src="http://arcanecode.files.wordpress.com/2012/08/snaghtml2ae15a_thumb.png?w=604&#038;h=342" width="604" height="342" /></a></p>
<p>You are now presented with the spiffy new table designer. Using it is fairly straightforward, but has some nice abilities.</p>
<p><a href="http://arcanecode.files.wordpress.com/2012/08/image3.png"><img style="background-image:none;margin:0 auto;padding-left:0;padding-right:0;display:block;float:none;padding-top:0;border-width:0;" title="image" border="0" alt="image" src="http://arcanecode.files.wordpress.com/2012/08/image_thumb3.png?w=557&#038;h=301" width="557" height="301" /></a></p>
<p>You can begin by simply going to the Name area, and typing in new column names. I’m going to start by changing the word Id to ArcaneId. Next, move to the Data Type box and hit the dropdown. You’ll be presented with a dizzying array of data types!</p>
<p><a href="http://arcanecode.files.wordpress.com/2012/08/image4.png"><img style="background-image:none;margin:0 auto;padding-left:0;padding-right:0;display:block;float:none;padding-top:0;border-width:0;" title="image" border="0" alt="image" src="http://arcanecode.files.wordpress.com/2012/08/image_thumb4.png?w=162&#038;h=316" width="162" height="316" /></a></p>
<p>For now I’ll leave it as int, since this will be my primary key, but I’ll add other types momentarily. I’ll leave Allow Nulls off, as well as leaving the default empty. Now add a column by moving down to the next row in the grid, perhaps call it BlogUrl, nvarchar(256). Note that when you pick the nvarchar column type, you’ll have to type right inside the Data Type text area to change the length of the column. Finally add a DateUpdated column, Date data type, an set the default to GETDATE(). </p>
<p>Note that as you’ve filled in your columns in the designer, the T-SQL in the box underneath is also updating. It’s a two way street, shift down to the T-SQL code on the bottom. Let’s add a fourth column, but put it under the BlogUrl but above the DateUpdated. Let’s name it BlogAuthor, nvarchar(256), NULL (we’ll allow nulls) and no default. </p>
<p>When you get to the end of the line and VS has confirmed this is valid T-SQL code, it will update the designer area on the top to reflect what you’ve done below. </p>
<p>There is one more thing we should do, something that’s quite common especially in data warehousing. We should have the primary key be an Identity type, that is a column whose value auto-increments with each inserted record. We can’t do that via the designer area at the top. While we could move down to the T-SQL area at the bottom and just type it in, there is a way to do it graphically. </p>
<p>In the designer, click on the row with the ArcaneId. Now go to the Properties window (generally over on the right, below the Solution Explorer if you still have the default VS seutp). About 2/3 the way down you’ll see a property called Identity Specification. Using the + button expand it, then change the Is Identity property to true. </p>
<p><a href="http://arcanecode.files.wordpress.com/2012/08/image5.png"><img style="background-image:none;margin:0 auto;padding-left:0;padding-right:0;display:block;float:none;padding-top:0;border-width:0;" title="image" border="0" alt="image" src="http://arcanecode.files.wordpress.com/2012/08/image_thumb5.png?w=301&#038;h=471" width="301" height="471" /></a></p>
<p>Now your designer window should look something like:</p>
<p><a href="http://arcanecode.files.wordpress.com/2012/08/image6.png"><img style="background-image:none;margin:0 auto;padding-left:0;padding-right:0;display:block;float:none;padding-top:0;border-width:0;" title="image" border="0" alt="image" src="http://arcanecode.files.wordpress.com/2012/08/image_thumb6.png?w=556&#038;h=303" width="556" height="303" /></a></p>
<p>But that’s just the start, for this isn’t just a table designer, but a designer for keys, constraints, indexes, and more! But that will wait for the next post in the series. </p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/arcanecode.wordpress.com/2224/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/arcanecode.wordpress.com/2224/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=arcanecode.com&#038;blog=340781&#038;post=2224&#038;subd=arcanecode&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://arcanecode.com/2012/08/14/sql-server-data-tools-in-visual-studio-2012table-designer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/8436cd3ff437697b2608405422efa4da?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">arcanecode</media:title>
		</media:content>

		<media:content url="http://arcanecode.files.wordpress.com/2012/08/snaghtml28a093_thumb.png" medium="image">
			<media:title type="html">SNAGHTML28a093</media:title>
		</media:content>

		<media:content url="http://arcanecode.files.wordpress.com/2012/08/snaghtml2ae15a_thumb.png" medium="image">
			<media:title type="html">SNAGHTML2ae15a</media:title>
		</media:content>

		<media:content url="http://arcanecode.files.wordpress.com/2012/08/image_thumb3.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://arcanecode.files.wordpress.com/2012/08/image_thumb4.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://arcanecode.files.wordpress.com/2012/08/image_thumb5.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://arcanecode.files.wordpress.com/2012/08/image_thumb6.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
		<item>
		<title>SQL Saturday 167&#8211;Columbus GA&#8211;Sept 8 2012</title>
		<link>http://arcanecode.com/2012/08/13/sql-saturday-167columbus-gasept-8-2012/</link>
		<comments>http://arcanecode.com/2012/08/13/sql-saturday-167columbus-gasept-8-2012/#comments</comments>
		<pubDate>Tue, 14 Aug 2012 03:55:43 +0000</pubDate>
		<dc:creator>arcanecode</dc:creator>
				<category><![CDATA[SQL Saturday]]></category>
		<category><![CDATA[Columbus GA]]></category>

		<guid isPermaLink="false">https://arcanecode.wordpress.com/?p=2266</guid>
		<description><![CDATA[It’s almost here! SQL Saturday #167, the first ever for Columbus GA. It looks to be quite a nice event, with a great variety of topics. There’s a lot of BI, including a PreCon on PowerPivot. I’ll be giving a presentation on Saturday on “The Decoder Ring for Data Warehousing/BI” in which you’ll cut through [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=arcanecode.com&#038;blog=340781&#038;post=2266&#038;subd=arcanecode&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>It’s almost here! <a href="http://www.sqlsaturday.com/167/eventhome.aspx" target="_blank">SQL Saturday #167</a>, the first ever for Columbus GA. It looks to be quite a nice event, with a great variety of topics. There’s a lot of BI, including a PreCon on PowerPivot. I’ll be giving a presentation on Saturday on “The Decoder Ring for Data Warehousing/BI” in which you’ll cut through all the hype to get an understanding of all the words behind data warehousing and business intelligence. </p>
<p>This looks to be a great event, so hurry up and register before it sells out. It seems to be in the perfect location, centrally located (in other words just a few hours drive) between Birmingham, Atlanta, Montgomery, Troy and Dothan. So no more excuses, get your SQL Saturday on!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/arcanecode.wordpress.com/2266/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/arcanecode.wordpress.com/2266/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=arcanecode.com&#038;blog=340781&#038;post=2266&#038;subd=arcanecode&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://arcanecode.com/2012/08/13/sql-saturday-167columbus-gasept-8-2012/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/8436cd3ff437697b2608405422efa4da?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">arcanecode</media:title>
		</media:content>
	</item>
		<item>
		<title>SQL Server Data Tools in Visual Studio 2012&#8211;Publish Database Profile</title>
		<link>http://arcanecode.com/2012/08/07/sql-server-data-tools-in-visual-studio-2012publish-database-profile/</link>
		<comments>http://arcanecode.com/2012/08/07/sql-server-data-tools-in-visual-studio-2012publish-database-profile/#comments</comments>
		<pubDate>Tue, 07 Aug 2012 06:31:00 +0000</pubDate>
		<dc:creator>arcanecode</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SSDT]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[Visual Studio 2012]]></category>
		<category><![CDATA[Visual Studio Database Projects]]></category>

		<guid isPermaLink="false">https://arcanecode.wordpress.com/?p=2210</guid>
		<description><![CDATA[One of the new features in SSDT, and what I consider to be my favorite, is the Publish Database Profiles. With database projects you could set a multitude of settings, everything from ANSI NULLS to whether to drop and create the database with each build. The only issue was these settings applied to the entire [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=arcanecode.com&#038;blog=340781&#038;post=2210&#038;subd=arcanecode&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>One of the new features in SSDT, and what I consider to be my favorite, is the Publish Database Profiles. With database projects you could set a multitude of settings, everything from ANSI NULLS to whether to drop and create the database with each build. The only issue was these settings applied to the entire project; you had to change them each time you wanted to deploy to a different server, or to change the rules (overwrite vs. incremental for example).</p>
<p>New with SSDT are Publish profiles. They allow you to establish a set of rules and save them for reuse. To start with, right click on the <em>project </em>name and pick Publish from the menu. </p>
<p><a href="http://arcanecode.files.wordpress.com/2012/08/image.png"><img style="background-image:none;padding-left:0;padding-right:0;display:block;float:none;margin-left:auto;margin-right:auto;padding-top:0;border-width:0;" title="image" border="0" alt="image" src="http://arcanecode.files.wordpress.com/2012/08/image_thumb.png?w=455&#038;h=231" width="455" height="231" /></a></p>
<p>You’ll now see a blank publish page.</p>
<p><a href="http://arcanecode.files.wordpress.com/2012/08/snaghtml360f9789.png"><img style="background-image:none;padding-left:0;padding-right:0;display:block;float:none;margin-left:auto;margin-right:auto;padding-top:0;border-width:0;" title="SNAGHTML360f9789" border="0" alt="SNAGHTML360f9789" src="http://arcanecode.files.wordpress.com/2012/08/snaghtml360f9789_thumb.png?w=530&#038;h=265" width="530" height="265" /></a></p>
<p>Let’s start by tweaking some database settings. Click the Advanced button on the lower right. </p>
<p><a href="http://arcanecode.files.wordpress.com/2012/08/snaghtml36114075.png"><img style="background-image:none;margin:0 auto;padding-left:0;padding-right:0;display:block;float:none;padding-top:0;border-width:0;" title="SNAGHTML36114075" border="0" alt="SNAGHTML36114075" src="http://arcanecode.files.wordpress.com/2012/08/snaghtml36114075_thumb.png?w=405&#038;h=496" width="405" height="496" /></a></p>
<p>Here you can get to all of the options you can use to fine tune your database deployment. The most common appear at the top, the less changed ones appear in the list below. In this image I’ve checked on the option to Always re-create the database. This option will wipe out the existing database and recreate it from scratch. </p>
<p>Use this particular option with caution, especially if you are doing it to a database you are sharing with your co-workers (or even worse, production!). When your rebuild the database you’ll also lose any data and have to reload. Sometimes this is a good option, especially in the early stages of development when you’ve made massive changes to the database, or perhaps have gone into the database and made a lot of changes outside the scope of SSDT. </p>
<p>There may be other options you need to change, based on your environment or DBA requirements. Once you’ve changed your options click OK to return to the previous screen. </p>
<p>Back on the Publish Database settings dialog I’ll set the target database connection, and the name I want to use for the database. I can also set the output script name if I wish. </p>
<p>&#160;</p>
<p><a href="http://arcanecode.files.wordpress.com/2012/08/snaghtml36153d0b.png"><img style="background-image:none;padding-left:0;padding-right:0;display:block;float:none;margin-left:auto;margin-right:auto;padding-top:0;border-width:0;" title="SNAGHTML36153d0b" border="0" alt="SNAGHTML36153d0b" src="http://arcanecode.files.wordpress.com/2012/08/snaghtml36153d0b_thumb.png?w=530&#038;h=265" width="530" height="265" /></a></p>
<p>Next, I want to be able to save this profile so I can reuse it later. Check on the “Add profile to project” option in the lower left, then click the Save Profile As… button. </p>
<p><a href="http://arcanecode.files.wordpress.com/2012/08/snaghtml36195ad8.png"><img style="background-image:none;padding-left:0;padding-right:0;display:block;float:none;margin-left:auto;margin-right:auto;padding-top:0;border-width:0;" title="SNAGHTML36195ad8" border="0" alt="SNAGHTML36195ad8" src="http://arcanecode.files.wordpress.com/2012/08/snaghtml36195ad8_thumb.png?w=557&#038;h=333" width="557" height="333" /></a></p>
<p>I gave it a good name, and made sure to include the most important options such as RecreateDB to indicate a database recreate was one of the options. </p>
<p>As I write this however, there is a bug with SSDT. When you click the “Add Profile to project” button it immediately adds a profile with the original default name. Then when you click the Save button in the dialog above, it adds the profile again, totally ignoring the name you give it. Instead it uses the default name again, only this time with an _1. </p>
<p>I’ve been assured that this bug is already known and has been fixed, and will be released with the next update to SSDT in VS2012. So depending on when you read this, it may or may not be an issue. Regardless, the fix is very easy, just rename the new .publish.xml file to reflect what you wanted it to be. </p>
<p>Once saved come back and hit Publish. The database will now be deployed to the server and the profile will be added to the solution. Here it is, after I’ve renamed the publish profile.</p>
<p><a href="http://arcanecode.files.wordpress.com/2012/08/image1.png"><img style="background-image:none;border-bottom:0;border-left:0;margin:0 auto;padding-left:0;padding-right:0;display:block;float:none;border-top:0;border-right:0;padding-top:0;" title="image" border="0" alt="image" src="http://arcanecode.files.wordpress.com/2012/08/image_thumb1.png?w=367&#038;h=386" width="367" height="386" /></a></p>
<p>Note that I’ve given it a naming convention that specifies the database name, the target server, and any critical options. Here I’ve added “Overwrite” to indicate what will happen when I run it. </p>
<p>To run it, just double click on it. First, Visual Studio will do a build of the SSDT project. If there are any errors the process will be halted and you’ll need to fix them. If not, you’ll be presented with the publish dialog, this time with everything filled out. </p>
<p><a href="http://arcanecode.files.wordpress.com/2012/08/snaghtml98453db.png"><img style="background-image:none;border-bottom:0;border-left:0;margin:0 auto;padding-left:0;padding-right:0;display:block;float:none;border-top:0;border-right:0;padding-top:0;" title="SNAGHTML98453db" border="0" alt="SNAGHTML98453db" src="http://arcanecode.files.wordpress.com/2012/08/snaghtml98453db_thumb.png?w=530&#038;h=265" width="530" height="265" /></a></p>
<p>All you have to do is click Publish and the database will be created/updated using the options you’d picked previously, to the server which you had previously indicated. </p>
<p>Now for the real fun. Repeat the above steps only this time do NOT check the overwrite database option. Now, (after renaming the new profile) you have two publish profiles to pick from. </p>
<p><a href="http://arcanecode.files.wordpress.com/2012/08/image2.png"><img style="background-image:none;border-bottom:0;border-left:0;margin:0 auto;padding-left:0;padding-right:0;display:block;float:none;border-top:0;border-right:0;padding-top:0;" title="image" border="0" alt="image" src="http://arcanecode.files.wordpress.com/2012/08/image_thumb2.png?w=355&#038;h=396" width="355" height="396" /></a></p>
<p>Take this even further. In my current project I have 8 profiles. An incremental and overwrite option for my local computer, the development server, the user acceptance testing server, and the production server. (In my case it’s a one man project, I’m the developer and the DBA all in one.) No longer do I have to juggle the server name, or even worse do a publish but forget to change the server from production back to local. </p>
<p>By far I think this is my favorite feature in SSDT. </p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/arcanecode.wordpress.com/2210/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/arcanecode.wordpress.com/2210/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=arcanecode.com&#038;blog=340781&#038;post=2210&#038;subd=arcanecode&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://arcanecode.com/2012/08/07/sql-server-data-tools-in-visual-studio-2012publish-database-profile/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/8436cd3ff437697b2608405422efa4da?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">arcanecode</media:title>
		</media:content>

		<media:content url="http://arcanecode.files.wordpress.com/2012/08/image_thumb.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://arcanecode.files.wordpress.com/2012/08/snaghtml360f9789_thumb.png" medium="image">
			<media:title type="html">SNAGHTML360f9789</media:title>
		</media:content>

		<media:content url="http://arcanecode.files.wordpress.com/2012/08/snaghtml36114075_thumb.png" medium="image">
			<media:title type="html">SNAGHTML36114075</media:title>
		</media:content>

		<media:content url="http://arcanecode.files.wordpress.com/2012/08/snaghtml36153d0b_thumb.png" medium="image">
			<media:title type="html">SNAGHTML36153d0b</media:title>
		</media:content>

		<media:content url="http://arcanecode.files.wordpress.com/2012/08/snaghtml36195ad8_thumb.png" medium="image">
			<media:title type="html">SNAGHTML36195ad8</media:title>
		</media:content>

		<media:content url="http://arcanecode.files.wordpress.com/2012/08/image_thumb1.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://arcanecode.files.wordpress.com/2012/08/snaghtml98453db_thumb.png" medium="image">
			<media:title type="html">SNAGHTML98453db</media:title>
		</media:content>

		<media:content url="http://arcanecode.files.wordpress.com/2012/08/image_thumb2.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
		<item>
		<title>SQL Server Data Tools in Visual Studio 2012&#8211;Importing a Database</title>
		<link>http://arcanecode.com/2012/08/02/sql-server-data-tools-in-visual-studio-2012importing-a-database/</link>
		<comments>http://arcanecode.com/2012/08/02/sql-server-data-tools-in-visual-studio-2012importing-a-database/#comments</comments>
		<pubDate>Thu, 02 Aug 2012 19:52:00 +0000</pubDate>
		<dc:creator>arcanecode</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SSDT]]></category>
		<category><![CDATA[Visual Studio 2012]]></category>
		<category><![CDATA[Visual Studio Database Projects]]></category>

		<guid isPermaLink="false">https://arcanecode.wordpress.com/?p=2192</guid>
		<description><![CDATA[In the previous post we saw how to create a new project using SSDT. In this entry we’ll see how to import an existing database into the project. Start by right clicking on the project (not the solution) and pick Import, Database. The Import Database is similar to the one from the 2010 database projects, [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=arcanecode.com&#038;blog=340781&#038;post=2192&#038;subd=arcanecode&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>In the previous post we saw how to create a new project using SSDT. In this entry we’ll see how to import an existing database into the project. Start by right clicking on the <em>project</em> (not the solution) and pick Import, Database.</p>
<p><a href="http://arcanecode.files.wordpress.com/2012/07/image1.png"><img style="background-image:none;border-bottom:0;border-left:0;margin:0 auto;padding-left:0;padding-right:0;display:block;float:none;border-top:0;border-right:0;padding-top:0;" title="image" border="0" alt="image" src="http://arcanecode.files.wordpress.com/2012/07/image_thumb1.png?w=781&#038;h=237" width="781" height="237" /></a></p>
<p>The Import Database is similar to the one from the 2010 database projects, but simplified. Use the New Connection button to setup a connection to your database (here I picked Adventure Works 2012). Target Project is disabled, since it’s in the context of the current project. </p>
<p>Import settings can be left at their defaults. The one thing to note is the Folder structure drop down. I personally prefer the default of Schema\Object Type. You can also pick None, which will put all the SQL files in the root of the project. I wouldn’t recommend this option, as it will quickly get difficult to find the files you need to edit. You can also organize by just Schema, or just Object Type. If you are a hard core DBA you might find Object Type more comfortable, since it’s closer to the Object Explorer in SSMS. As I said though, my experience has been Schema\Object Type is the easiest to work with. </p>
<p><a href="http://arcanecode.files.wordpress.com/2012/07/snaghtml35019c45.png"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:block;float:none;margin-left:auto;border-top:0;margin-right:auto;border-right:0;padding-top:0;" title="SNAGHTML35019c45" border="0" alt="SNAGHTML35019c45" src="http://arcanecode.files.wordpress.com/2012/07/snaghtml35019c45_thumb.png?w=529&#038;h=454" width="529" height="454" /></a></p>
<p>When it’s done just click finish, and you’ll see the new structure in the Solution Explorer. Each folder at the top level represents a Schema, or database level object such as Database Triggers. </p>
<p>In the image below, you can see I expanded two of the schemas, HumanResources and Person. Under these are folders for all of the present object types. </p>
<p><a href="http://arcanecode.files.wordpress.com/2012/07/image2.png"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:block;float:none;margin-left:auto;border-top:0;margin-right:auto;border-right:0;padding-top:0;" title="image" border="0" alt="image" src="http://arcanecode.files.wordpress.com/2012/07/image_thumb2.png?w=356&#038;h=417" width="356" height="417" /></a></p>
<p>Note that the HumanResources schema has a folder for Stored Procedures, while Person does not. This is simply because in the database the Person schema has no stored procedures. If you want to add a stored procedure to the Person schema, you’ll want to add a folder to the Person structure and name it Stored Procedures. This isn’t required, you can put the SQL file anywhere you want, but if you mimic the existing organization structure you’ll make it much easier to maintain and expand the SSDT project as you move forward. </p>
<p>Lets expand a branch to see all the files. </p>
<p><a href="http://arcanecode.files.wordpress.com/2012/07/image3.png"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:block;float:none;margin-left:auto;border-top:0;margin-right:auto;border-right:0;padding-top:0;" title="image" border="0" alt="image" src="http://arcanecode.files.wordpress.com/2012/07/image_thumb3.png?w=321&#038;h=440" width="321" height="440" /></a></p>
<p>Finally! We’ve drilled down to the lowest level and can see the individual files that are needed to make up the project. </p>
<p>In the next installment we’ll look at altering some of the database settings. Over the next few weeks we’ll be looking at deployment tools, database snapshots, and how to edit the various file types, and some of the enhancements there, especially around the table editor.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/arcanecode.wordpress.com/2192/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/arcanecode.wordpress.com/2192/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=arcanecode.com&#038;blog=340781&#038;post=2192&#038;subd=arcanecode&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://arcanecode.com/2012/08/02/sql-server-data-tools-in-visual-studio-2012importing-a-database/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/8436cd3ff437697b2608405422efa4da?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">arcanecode</media:title>
		</media:content>

		<media:content url="http://arcanecode.files.wordpress.com/2012/07/image_thumb1.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://arcanecode.files.wordpress.com/2012/07/snaghtml35019c45_thumb.png" medium="image">
			<media:title type="html">SNAGHTML35019c45</media:title>
		</media:content>

		<media:content url="http://arcanecode.files.wordpress.com/2012/07/image_thumb2.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://arcanecode.files.wordpress.com/2012/07/image_thumb3.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
		<item>
		<title>SQL Server Data Tools in Visual Studio 2012</title>
		<link>http://arcanecode.com/2012/07/31/sql-server-data-tools-in-visual-studio-2012/</link>
		<comments>http://arcanecode.com/2012/07/31/sql-server-data-tools-in-visual-studio-2012/#comments</comments>
		<pubDate>Tue, 31 Jul 2012 06:32:00 +0000</pubDate>
		<dc:creator>arcanecode</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SSDT]]></category>
		<category><![CDATA[T-SQL]]></category>
		<category><![CDATA[Visual Studio 2010]]></category>
		<category><![CDATA[Visual Studio 2012]]></category>
		<category><![CDATA[Visual Studio Database Projects]]></category>

		<guid isPermaLink="false">https://arcanecode.wordpress.com/?p=2182</guid>
		<description><![CDATA[In August I’ll be giving a couple of presentations at devLink. One of them will be on the new SQL Server Data Tools that was released with SQL Server 2012. As you may be aware, I’ve been a proponent of Visual Studio Database Projects since their initial release with Visual Studio 2005. With SQL Server [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=arcanecode.com&#038;blog=340781&#038;post=2182&#038;subd=arcanecode&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>In August I’ll be giving a couple of presentations at <a href="http://www.devlink.net/" target="_blank">devLink</a>. One of them will be on the new SQL Server Data Tools that was released with SQL Server 2012. As you may be aware, I’ve been a proponent of Visual Studio Database Projects since their initial release with Visual Studio 2005. </p>
<p>With SQL Server 2012 the SQL team took ownership of the database projects. They completely retooled them so now they can release them as “out of band” add-ons for Visual Studio. The new version is called SQL Server Data Tools, or SSDT for short. It’s included with VS2012, or you can download a version compatible with Visual Studio 2010 at <a title="http://msdn.microsoft.com/en-us/data/tools.aspx" href="http://msdn.microsoft.com/en-us/data/tools.aspx">http://msdn.microsoft.com/en-us/data/tools.aspx</a>. </p>
<p>I’ve been using it for a real world production project for some time now. While I like it, there are some major differences between the new SSDT and the former database projects. Over the next few blog posts I want to highlight some of those differences, culminating with the devLink presentation. </p>
<p>For this series of posts I’ll be using the Visual Studio 2012 Release Candidate, which from here on I’ll simply refer to as VS2012. As this is a Release Candidate there shouldn’t be any noticeable changes between now and the final release. </p>
<p>If you are still on VS 2010 don’t fret, what I’ll describe applies to it as well, assuming you have gone to the link above and downloaded the SSDT add in. </p>
<p>The first difference is with creating a new project. With VS 2012 the older database projects are gone. Only in 2010 can you still do both. Here’s the new project screen shot from VS2010:</p>
<p><a href="http://arcanecode.files.wordpress.com/2012/07/snaghtml30634815.png"><img style="background-image:none;border-bottom:0;border-left:0;margin:0 auto;padding-left:0;padding-right:0;display:block;float:none;border-top:0;border-right:0;padding-top:0;" title="SNAGHTML30634815" border="0" alt="SNAGHTML30634815" src="http://arcanecode.files.wordpress.com/2012/07/snaghtml30634815_thumb.png?w=604&#038;h=342" width="604" height="342" /></a></p>
<p>&#160;</p>
<p>Here is the screen shot from VS2012.</p>
<p><a href="http://arcanecode.files.wordpress.com/2012/07/snaghtml3065daa3.png"><img style="background-image:none;border-bottom:0;border-left:0;margin:0 auto;padding-left:0;padding-right:0;display:block;float:none;border-top:0;border-right:0;padding-top:0;" title="SNAGHTML3065daa3" border="0" alt="SNAGHTML3065daa3" src="http://arcanecode.files.wordpress.com/2012/07/snaghtml3065daa3_thumb.png?w=604&#038;h=371" width="604" height="371" /></a></p>
<p>As you can see, the Database branch is gone and only the SQL Server Database Project exists. </p>
<p>Now for the next difference. With VSDB Projects, when you created a new project you were immediately walked through a wizard that helped you with various default choices, and allowed you to import a database. With SSDT, once you create a new project you are given a blank slate, an empty project to start from. </p>
<p><a href="http://arcanecode.files.wordpress.com/2012/07/image.png"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:block;float:none;margin-left:auto;border-top:0;margin-right:auto;border-right:0;padding-top:0;" title="image" border="0" alt="image" src="http://arcanecode.files.wordpress.com/2012/07/image_thumb.png?w=360&#038;h=259" width="360" height="259" /></a>&#160;</p>
<p>If you are creating a new database from scratch, it is left to you to create the entire folder structure, and to name your files correctly. </p>
<p>I’d highly suggest though that you import at least one database, to see how the wizard organizes things, so that you can follow suit. Importing a database is as easy as it was in VSDB Projects, but we’ll save that for the subject of the next blog post. </p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/arcanecode.wordpress.com/2182/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/arcanecode.wordpress.com/2182/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=arcanecode.com&#038;blog=340781&#038;post=2182&#038;subd=arcanecode&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://arcanecode.com/2012/07/31/sql-server-data-tools-in-visual-studio-2012/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/8436cd3ff437697b2608405422efa4da?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">arcanecode</media:title>
		</media:content>

		<media:content url="http://arcanecode.files.wordpress.com/2012/07/snaghtml30634815_thumb.png" medium="image">
			<media:title type="html">SNAGHTML30634815</media:title>
		</media:content>

		<media:content url="http://arcanecode.files.wordpress.com/2012/07/snaghtml3065daa3_thumb.png" medium="image">
			<media:title type="html">SNAGHTML3065daa3</media:title>
		</media:content>

		<media:content url="http://arcanecode.files.wordpress.com/2012/07/image_thumb.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
	</channel>
</rss>
