Tag: Redgate

  • Color Coding a Database on All Servers with SQL Prompt

    SQL Prompt has some nice color coding features, but sometimes I want a database to keep the same color, regardless of instance. I don’t know that I’d recommend this, but since I work in demo environments across versions, this is a handy trick for me.

    In the SQL Prompt menu, there is an options item.

    2020-07-11 10_39_15-

    Clicking this brings up a dialog with a number of sections along the left and details on the right. Near the bottom is the color menu.

    2020-07-11 10_39_26-SQL Prompt – Options

    When I decide to color code a database, I click “add” and I get this view. The cursor defaults to the Server/Group edit box, and I’ve typically entered a server name here.

    2020-07-11 10_39_39-SQL Prompt – Options

    However, I can skip this and just enter a database.

    2020-07-11 10_39_51-SQL Prompt – Options

    In this configuration, every time I open a query window to a database called SimpleTalk_1_Dev, no matter which instance, it will be colored purple.

    I can see this when connecting to my default local instance.

    2020-07-11 10_40_01-SQLQuery2.sql - ARISTOTLE.SimpleTalk_1_Dev (ARISTOTLE_Steve (52))_ - Microsoft S

    I also test things on a v14 (SQL 2017) instance, and if I connect there, I see the same thing.

    2020-07-11 10_41_08-SQLQuery6.sql - ARISTOTLE_SQL2017.SimpleTalk_1_Dev (ARISTOTLE_Steve (60)) - Micr

    In some sense, this is an edge case. I demo similar things across instances and versions, and it’s nice to keep colors simple rather than entering dozens of instance names. However, it’s not something many people do, as they often use the same database name on different instances. That’s a more common scenario.

    That’s supported as well. Notice here I’ve entered just a server with no database.

    2020-07-11 10_47_12-SQL Prompt – Options

    Now every database I connect to on this instance will be colored green. Note that the purple still overrides because it is specific to a database. The third tab below is connected to the SimpleTalk_1_Dev database.

    2020-07-11 10_47_19-SQLQuery6.sql - ARISTOTLE_SQL2017.SimpleTalk_1_Dev (ARISTOTLE_Steve (60)) - Micr

    SQL Prompt has some amazing features, but color coding is one that helps me keep track of which databases and instances I’m connected to in a query window. If you‘ve never configured this, give it a try.

    If you’ve never tried SQL Prompt, it’s incredible. Download an eval today and see what you think.

  • Setting up a New SQL Change Automation Project

    It’s been awhile since I’ve set up a new project in Redgate’s SQL Change Automation project. I’ve mostly used this in Visual Studio, but I need to demo something to a client, so I decided to document the process of getting started here.

    There are often updates to this product, as we release every week or two, so the first thing was the click on the banner in SSMS and upgrade to the latest version. Once you have things working, you don’t need to do this often, but you should to it quarterly at least.

    2020-07-07 18_00_55-SQL Change Automation

    My Environment

    I’ve got multiple copies of my databases on one instance. I have 1 for development, 1 for QA, and one for Prod. This is a good PoC setup for getting familiar with the product.

    2020-07-09 10_13_51-SQL Change Automation - Microsoft SQL Server Management Studio

    The flow is we only make changes in SimpleTalk_1_Dev with SSMS. Everything else will happen through automation.

    These databases already have objects in them, but they’re not overly complex.

    2020-07-07 17_56_15-SQLQuery1.sql - ARISTOTLE_SQL2017.Sandbox (ARISTOTLE_Steve (54)) - Microsoft SQL

    I have SQL Change Automation (SCA) installed in SSMS, versions 4.2.20176 and 18.5 respectively. Let’s see if we can do some development.

    Creating a Project

    When I open the SCA tab in SSMs, I see the open and new project options.

    2020-07-08 10_22_54-SQL Change Automation - Microsoft SQL Server Management Studio

    We are creating a new project here, so let’s click the button to do that. Once I do that, I get a dialog that appears. I’ve entered a name and then select my folder where I keep code.

    Note, I’ve picked a folder name here, and the project will create a subfolder under this with the name of the Project as the folder name. In this case, my actual project files will be in E:\Documents\git\SimpleTalkDemo\SimpleTalkDB.

    2020-07-09 11_24_25-New project setup

    I do want the project folder under version control. Before I have SCA do anything, I use a command line and initialize this for git. If you don’t know how this works, I’ve got a post on that.

    2020-07-08 19_41_49-SQLServerCentral – The #1 SQL Server community

    Now I can go back and connect to the development source. This is the dev database. There doesn’t need to be anything in here, but in this case, it’s a copy of the schema from production. Once I enter the credentials and pick the database, I come back to this screen and I see the first part of my project.

    2020-07-08 19_43_53-New project setup

    Clicking Next gives us the filter screen. This uses the filter files from SQL Compare to determine which objects we are including for development purposes. For most projects, we don’t filter anything. We want all objects to be included in our project.

    2020-07-08 19_44_00-New project setup

    I’ll leave this alone and click Next. The last screen is the baseline screen. This allows me to set a baseline or not. A baseline is a view of what the target database looks like right now. In this case, this is the production database.

    This process will look at the objects in that database and create a script that builds up a base database to the same state as production right now. That is useful because all items we add to this project depend on the state being this way. You can read more about baselines in the documentation.

    2020-07-08 19_44_07-New project setup

    I will configure this to connect to my production database and once that’s correct, I’ll click “Create” to set up the project.

    2020-07-09 11_26_26-New project setup

    The project gets created fairly quickly, and once it’s complete, I get a summary. As you can see below, the project was set up and there are some notes about what was done.

    2020-07-09 11_27_07-SQL Change Automation - Microsoft SQL Server Management Studio

    You can see that one migration script was generated and this was for my baseline. This contains all the objects in my current production database, which won’t be deployed unless I have an empty database, like a CI database.

    There were also 19 programmable objects, which are views, functions, and stored procedures. These are items that we don’t want to track each change to, but only the state at a point in time.

    All of this is reflected in my project folder, which you can see below. There are subfolders below some of these for the various object code.

    2020-07-09 11_30_14-SimpleTalkDB

    I’ve got a new project. Now I want to commit this to version control first, and then I can start development work.

    2020-07-09 11_32_04-cmd

    If you’ve never worked with SQL Change Automation, download an eval and give it a try today. I’ll be documenting the process as I build out a demo for a customer, and you can follow along.

  • A Virtual Trip Down Under

    I had a great holiday last week, getting away from my home for the first time in months. It’s been an extra strange time for me as I usually have a number of personal and business trips I’ve taken by this time, but with the pandemic, I’ve been at home, like most of you. However, we managed to find a campground open, and we packed up the family, dogs, and horses for a week in the South Dakota hills.

    I’m back, and while I won’t be getting on an airplane, I am going to travel virtually to Australia this week for quite an action packed Redgate Streamed APAC Edition. I’m slightly disappointed that I won’t be able to shake hands with Troy Hunt, but neither will Damian Brady, Greg Low, or Hamish Watson. I was on stage last summer with those three, and I immensely enjoyed the experience.

    This year we’re holding the event virtually in the Australia time zone, so I’ll be working late afternoon and evening my time for the event on Thursday, July 2. Time zones certainly get strange when I do things in Australia, and it’s the one place I’ve traveled where I feel really out of place when contacting this side of the world. The last time I was there, I watched my daughter’s evening volleyball game as I was eating breakfast.

    I get to deliver a talk, and then I’ll settle in to watch everyone else and enjoy the other talks. All of these are expert software developers and data professionals, and I learn quite a bit from them on a regular basis. If you want to spend time later this week, register for the event and join me, wherever you are in the world. The one good thing with these virtual events is that we can attend them if they fit our schedule.

    I’m excited to talk DevOps, software development, and, of course, security with the incredible Troy Hunt. This is an exciting week back for me, but also a busy one as I prep for a look at the software challenges down under.

    Steve Jones

    Note: Podcasts paused this week as I have construction taking place at the house and nowhere to record.

  • Bringing Redgate Streamed Down Under

    Next week is the Redgate Streamed APAC Edition, on July 2. At least, July 2 in Australia. I’m still not sure what time it will be for me, and I am double checking all the schedules since Australia and New Zealand make me feel more disconnected from everywhere else in the world. I loved my trip last year, but crossing the dateline was a weird experience.

    You can register for the event and attend. It’s 0800-1430 in AEST, but I’m not going to try and figure out where that is anywhere else. You’re on your own for that one.

    This time I’ll be presenting and hosting the event from Colorado in the US. I also get to do a short interview with Troy Hunt, who is in incredible expert in his field. I follow his blog, have watched his presentations, and am somewhat disappointed I don’t get to meet him in person. Maybe next year.

    We also have some other amazing speakers:

    • Damian Brady, Senior Cloud Advocate at Microsoft
    • Steve Jones, Microsoft Data Platform MVP & SQLServerCentral Editor
    • Greg Low, Microsoft Data Platform MVP and founder of SQL Down Under
    • Hamish Watson, Microsoft Data Platform MVP and founder of SQL Down Under

    I’ve been blessed to be on the stage with each of these experts, and I am looking forward to learning more from them next week. We’ll be talking security, DevOps, compliance, and more. Register today and join me next week for some learning, inspiration, and excitement.

    As a  plus, Redgate is donating to the Australian Red Cross and the WHO for each person that attends, so be sure to tune in.