Generating An Empty Node

In BIML, Part 5, I talked about AdventureWorksDW2012 and AdventureWorksDW2012Node2. If you don’t know how to create an empty node for testing, it’s pretty easy. For this example, I’m going to assume that you have SQL Server 2012 or 2014 installed. If you’re still on 2008 R2 or earlier, this will still work but you’ll need to change all of the “AdventureWorksDW2012” references to be the correct version.

The first step is to download the AdventureWorksDW2012 database file. Once you have that, you can Attach it to your database—but be sure to remove the invalid log file reference when you attach! The following screen shot shows you the Attach Databases screen:

AttachDatabase

Once you have AdventureWorksDW2012 set up, right-click on the database and go to Tasks –> Generate Scripts.

GenerateScripts

From there, you’ll walk through a wizard. In this scenario, we want to script out all objects and make the new database a replica of the old—except without the data.

ScriptAllObjects

Click Next and you’ll have the option to save this in a new query window, which is what I’m going to do.

SaveToNewQueryWindow

This gives you a fairly long file which looks a little bit like:

Scripts

There’s just one problem with this: I still have everything named AdventureWorksDW2012, but I want it named AdventureWorksDW2012Node2. So let’s hit Ctrl+H and bring up the Quick Replace window.

RenameObjects

Then, we’ll fill out the “Find what:” and “Replace with:” sections and hit the “Replace All” button. That renames all references of AdventureWorksDW2012 in our script to be AdventureWorksDW2012Node2.

RenamedObjects

After we have all of that done, hit F5 or the Execute button and you now have an empty node for your own testing purposes.

Advertisements

One thought on “Generating An Empty Node

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s