Category: Blog

  • Getting Started with SQL Prompt 10

    This week we released SQL Prompt 10, which is an exciting milestone for us. I remember when I discovered this little gem for Database Weekly and sent it over to Redgate as something they might want to buy. They did and have made dramatic and amazing improvements over the last decade+.

    I’ll have a few notes on new features, some of which have been leaking out in v9 already. We’ve started to get away from holding all features until a new release and slowly trickling them out, sometimes as experimental feature flagged items.

    There is a new Welcome window,which I think is a nicer way to show off a feature than the tool tips. I can see a few things at a glance, have some links, and get this back from the SQL Prompt | Help menu at any time.

    2019-11-08 08_31_30-SQL Prompt - Welcome - Microsoft SQL Server Management Studio

    I think SQL Prompt is the best intellisense tool for SQL Server, and many people agree. If you’ve never tried it, you can get an eval today and see what you think. If you already use it, know that we’re still investing in the tool and driving it forward for the new data platform on SQL Server 2019.

  • Batch Scripting SQLCMD–#SQLNewBlogger

    Another post for me that is simple and hopefully serves as an example for people trying to get blogging as #SQLNewBloggers.

    I wouldn’t do this anymore, but I ran across a post where someone couldn’t use PowerShell in their organization. A poor decision, IMHO, for the Microsoft platform, but it is a restriction. In this case, the user wanted to get a batch file to run a SQLCMD script. This post shows how.

    Two Files

    Let’s suppose I have two files in a folder. In this case, I have a version.sql file that contains this:

    select @@version

    The other is my batch file, which I’ll name runsql.cmd. In this file, I’ll do a few things. First, suppress the code with this:

    @@echo off

    That’s just a good habit, though you might leave this out until things are working. Now, I will use a loop to get a list of files with an extension. I use the FOR loop in this way:

    for %%x in (*.sql) do (

    This gets a list of all .sql files in the current folder. For each one, we will process all statements inside the parenthesis. The open is on the line above, the close will be below.

    The next lines are my sqlcmd call and the various items I need. In my case, I’ll get the instance name as a parameter and use trusted authentication.

      sqlcmd -S "%1" -E -i %%x
    )

    I could use other parameters (%2, %3, etc.) to get a user and password if I wanted to. Instead, I’ll get the instance as a parameter, and then pass the filename in to sqlcmd with the –i parameter.

    When I run this, with my single .sql file, I see this:

    2019-10-15 10_55_48-cmd

    Easy to do, and I could add other .sql files in here if I wanted them to run.

    SQLNewBlogger

    This was a quick post to write in answer to someone asking a question. I knew about the %1, %2, and searched to find a quick SO post on getting filenames into a variable. It actually took about 5 minutes to research and test (and post) and then about 10 minutes to write this up.

    You could do this, showing some knowledge of learning and creating a solution. For extra credit, how can I capture output of this?

  • New HA Licensing Benefits

    Microsoft announced recently that they were changing the way licensing works for HA and DR situations. I think this is a great change, and the summary is:

    • You can have up to 3 other un-used secondaries for free
    • You can a sync on-prem replica, async on prem replica, and a remote DR replica.
    • You can run DBCC, backups, monitor resource data on the secondaries

    This is a huge change, mostly because most of us expected these would be acceptable uses already, but they weren’t. And many of us had to go ask for more licensing money.

    The Caveat

    There is a caveat here, actually two. You need:

    • Software assurance
    • A supported version of SQL Server

    Those two things mean you need to be under a support contract, but also that this benefit isn’t just SQL Server 2019, but back ported to all supported versions.

    That’s good new.

  • Focusing on Business Value

    This was a fun talk with David Atkinson at Redgate. We talk satellites, finance, and more. Including some early history of the company.

    We are talking about how to get things done for the business, to be effective in your work. Tools help, but it’s more that we want you to reframe the way you work to ensure that we don’t just try to get our specific task done, but ensure that our task gets a feature or fix into a customer’s hands.

    Take a quick 30 minutes break and enjoy this discussion. I had fun recording it and hope you do as well.