Product articles SQL Prompt SQL Formatting and Styles
Sharing SQL Prompt Code Snippets and…

Sharing SQL Prompt Code Snippets and Styles via the Redgate Platform

SQL Prompt users can now share formatting style or code snippets in designated Team spaces on the Redgate Platform. Louis Davidson explains how it works.

Guest post

This is a guest post from Louis Davidson.

Previously, I’ve described my “DIY solution” for sharing several different sources of SQL Prompt code snippets, in a single Snippet library, using just a shared folder (on Dropbox, OneDrive, Box, GitHub or similar) and source control.

It’s served me well enough, but it does have a few issues, particularly the lack of control over the snippets you share. If you simply share your snippets, or any files really, using a shared folder, there is little protection from an undesirable change occurring. Of course, I would still suggest that users keep a copy of their snippets in a version-controlled location, but then this restricts sharing to users who can or will use source control.

Now, though, if you own SQL Prompt as part of a Toolbelt or Toolbelt Essentials license, then you can now access the Redgate Platform, a cloud hosted service where you can safely share your SQL code snippets and SQL formatting styles with your coworkers.

In this, the first of two articles, I will walk through the process of setting up straightforward sharing via the Redgate platform. The next article will go into a bit more depth with a few topics about how it behaves when you have multiple people sharing snippets and styles, plus how that complexity has changed the structure of the files that are used to store snippets (and what to do to import your existing and new files).

Setting up sharing

Sharing via the Redgate platform requires some initial set up. One of the first steps you’ll encounter is a screen inviting you to create an organization (this is akin to an “installation” of the Redgate platform). All sharing takes place within and between teams, created in this organization.

Be aware that while it’s perfectly possible for two users within your team each to create their own organization in the Redgate Platform, it’s currently not possible for a user to participate in more than one organization, nor to share between organizations. Therefore, those two users will find that they are not allowed to share any snippets or styles! If you find yourself in this situation, the best option, for now, is to contact Redgate customer support to get one of the organizations deleted.

In short, it’s important that just one person should create just one organization. That person then sends out invitations to all other users to join teams within that organization. Here are the steps to follow.

1. Log in to Redgate platform

You will need to be using SQL Prompt v10.11 or later and be on a subscription license (for more details on SQL Prompt licensing, check here). If so, then you should see a new Log in to Redgate Platform option at the bottom of the SQL Prompt menu:

Login in to Redgate Platform

A window will be opened asking you if you are a Team Admin or Team Member. Since we’re setting up the platform for the first time, we’ll choose Team Admin.

As Team Admin, you will create the “team space” in the Redgate Platform, where all shared items will be stored and then invite all other team members to participate. You’ll first be taken to the Red Gate Platform website ( and you’ll need to log in with your Redgate ID (check out this article for more details).

2. Create the organization

Once you’ve logged in for the first time, and if you’re not currently a member of an organization, and have no pending invites to join one, you’ll arrive at the page to create an organization. This is a one-off, one-time only operation, and then all other users should be invited to join teams within that organization. If someone has already invited you to join a team, then on logging in you should, instead of seeing the page below, arrive at the page.

create organization

3. Create one or more teams

The next step is for the admin to create a team space, invite other users to join, and set their permissions.

create team

For demo purposes, I am starting out with a clean slate. I created an organization called “Test” and within it a team called Drsql’s Snippets. How you organize and name your teams will depend on what you want to share, and the types of users you are sharing with. More on that in the next article.

4. Invite team members and assign permissions

The next step is to invite the rest of the team, most likely as Team Members, although it’s also possible to invite them as a Team Admins.

invite team members

Here, I’m just going to invite myself, via another email address, which is where my company’s license is attached. After sending the invite, the invited users can then go to the following site: and accept the invitation (if they don’t get the email for some reason).

Oner I’ve accepted my own invite, this is how the screen looks:

review team members

Each team member is assigned a set of permissions: Team permissions, Styles permissions and Snippets permissions. At the team level, you can either be an admin or a member. For styles and snippets your permissions can be set to either Reader, Editor, or None:

assign permissions to team members

I’ve assigned Reader permissions to louis.davidson on both styles and snippets, so I can use them but not alter them. Users with no permissions will not have access to even use the snippets or styles, and users with “Editor” permissions can make changes. Simple, but effective so you can share your snippets to many people and give specific rights to each user.

As users accept invitations, they will see a screen confirming that they have joined a team and can start sharing:

joining a team

That is all there is to the Redgate Platform – it is simply a space for setting up and managing team spaces. When a developer shares a SQL Prompt formatting style or code snippet, it is automatically uploaded to the designated Team space on the Redgate Platform and made available to any other SQL Prompt users who have access to that space. The platform website doesn’t currently offer any indication of which snippets and styles are shared with which teams.

The action now switches back to SQL Prompt. The steps for adding snippets and styles to a team space, for sharing are easy, but not always super obvious. There is not really any mention of Redgate Platform that is obvious after you log in, and sharing doesn’t exactly jump out at you.

Sharing SQL Code Snippets

In the simplest and most common case, the goal for using the Redgate Platform is to have a set of code snippets and query styles that I want to share with a set of coworkers. For the time being, let’s assume this simple case: one person is creating and sharing snippets with a group of people.

I’ve accumulated a whole bunch of useful SQL code snippets, over time, many of which are of interest only to me, but some of which are helpful to co-workers. I’ve previously explained my use of SQL Prompt code snippets in Using SQL Prompt Code Snippets for Repetitive Tasks and SQL Prompt Snippets to Drop Columns and Tables and Handle Associated Dependencies

To share a useful code snippet with your team, open the snippet manager using the SQL Prompt menu. Just for demo purposes, and because I happened to have a conversation today about trustworthy databases, I’ll create the following snippet, which I call LD_TrustworthyDatabases:

create SQL code snippet

After creating the snippet, it appears in the list (sorting is part of why I prefix my snippets). You can right click the item in the list and click share (or there is a share button at the top):

share snippet to team

A dialog will appear and let you choose a team space within the Redgate Platform to share the snippet. I’ve only set up one team so far, Drsql’s Snippets, so I share it there. After sharing the snippet, it moves to a new group in the list that shows shared snippets:

searching for shared snippets

Now I go over to my other computer, log in using my other login that has a Redgate License, and I immediately see that I am a member of “Drsql’s Snippets” group, and now have access to the new shared snippet. Awesome.

Accessing shared snippets

However, I notice that the description has a typo. As a non-editing team member, the Share button is greyed out, and the typical edit button says View. Click View and you will see the normal editor, but you cannot make any changes (as of Version the right click menu says Edit, but it behaves as View).

To fix the wording in the snippet, I will have to ask drsql to make the change (it is handy that I know him well). Drsql can simply open the shared snippet and make the edit:

editing and saving a shared snippet

And now, after a short period of time passes (when I was testing this on two computers, it took a few minutes), my changes now show up on my other computer, ready to use.

Sharing Code Formatting Styles

I’ve described my preferred SQL formatting style in The Louis Davidson custom style for SQL Prompt and also how to create and maintain multiple code styles, each for a dedicated purpose, Using multiple custom SQL formatting styles in SQL Prompt.

To share these styles with the rest of the team you follow pretty much the same process as for sharing snippets. You can share style in these same teams, and then people you share them with can use them. The only real difference is the interface.

When you choose Styles from the SQL PromptOptions dialog, you see this:

SQL Prompt formatting syles

You don’t see the list of Styles you can use, rather you see the settings that apply to all styles. You need to click Edit Formatting Styles… which will show you the following screen, with any styles you have created alongside the built-in styles supplied by Redgate:

Pick a style to share

Now, right click the ellipsis next to any of the styles in your list. A menu will appear, and you can choose Share this style:

share a style

Choose the team with which to share it, and now you will see it in the Shared Styles section of the Active Styles menu in SQL Prompt:

Shared styles

Now everyone in my group can format code using my favorite style.


While it does have some complexity, the ability to share snippets and formatting styles in the Redgate Platform is a very welcome addition to a tool I use every day.

In this article, I’ve demo’d the basics of how the Redgate Platform works to let users of SQL Prompt share Snippets and Formatting Styles. I walked through the steps to configure your first team, which is most of the battle.

In this article, I’ve considered only the simplest possible set up: one user (me) sharing styles and snippets within a single team, where other members have only Reader permissions. Not a lot can go wrong!

However, more likely, you’ll want to share different sets of snippets with users across your organization, but not all of them to everyone. Users will be members of multiples teams. More than one user within any team will likely have Editor permissions. Things can get more complicated! What happens for example, when you get shared items with the same name, from multiple teams?

I’ll explore how to manage all this in the next article. I’ll also explain some changes that have been made to the way snippet code is stored, to allow team sharing. I’ll show how to import your legacy snippet code into SQL Prompt.

Tools in this post

SQL Prompt

Write, format, and refactor SQL effortlessly

Find out more

SQL Toolbelt

The industry-standard tools for SQL Server development and deployment.

Find out more

SQL Toolbelt Essentials

The industry-standard tools for SQL Server development and deployment.

Find out more