SQLServerCentral Article

How to create your custom GPT SQL Expert

,

Introduction

ChatGPT includes custom GPTs. You can create your own custom GPT. In this article, we will demonstrate how to create a custom GPT expert in SQL Server.

Requirements

To create your own GPT, you need to use the paid version of ChatGPT.

First, go to ChatGPT.

Secondly, if you don’t have the paid version, go to View plans.

View plans to enable Custom GPTs

Finally, upgrade your plan to a paid version in ChatGPT. You can use the Plus or the Pro version. The Business plan will work as well.

Plus plan to have Custom GPTs

Getting started

Let’s dive in.

First, in ChatGPT, go to the GPTs section.

Create your custom GPTs

Secondly, at the top right, select the Create button.

You will have two options to create your custom GPT:

Create button to create a custom GPT.

  • First, we have the Create option is a wizard with questions to create your GPT.
  • Secondly, the Configure option, which is a faster method to create a GPT. In this example, we will focus on the configure option.

Configure option for the GPT

Use the Configure add a logo for the custom GPT

First, press the plus button to create your logo.

+ Button to add a logo.

Secondly, you can upload a photo, create a new one using DALL·E (the ChatGPT image generator), or add your image.

Use DALL-E to generate a logo

Let’s try DALL·E.

First, we will create the virtual assistant:

Daniel:

A young woman with fair skin and long brown hair styled in a high ponytail. She wears a black over-ear headset with a cushioned headband and an adjustable microphone. Her calm expression and natural beauty are complemented by a subtle, gentle smile that doesn't show her teeth. She is dressed in a simple, snug navy blue cropped T-shirt and high-waisted denim jeans. The background is a neutral gray, with soft, even lighting that highlights her features.

Generated image

Secondly, I will add our SQLServerCentral Logo (use any image editor of your preference):

Assistant logo

Once created, use the Upload Photo option in ChatGPT to add the image created.

Upload photo for custom GPT

Add a name and a description to create your custom GPT

Once we have a logo, we will fill in the options.

First, we need to add a name for the GPT. In this case, we will call it the SQL ServerCentral assistant.

Name

Secondly, we will need a description explaining what this GPT does. In this example, we will add the following description:

SQL Server assistant GPT provides expert-level assistance on SQL Server topics, offering solutions for troubleshooting, query optimization. Leveraging knowledge from SQLServerCentral, it helps database administrators and developers with insights and solutions for SQL Server challenges.

The description should clearly explain what this GPT does and how it can help you. This description supports only 300 characters at the time this article was written.

Custom GPT description

Add instructions and provide conversation starter information to the custom GPT

In this section, we will explain our GPT the tone to use, content focus, style, and ethical guidelines.

Here we suggest some instructions:

  • First, adopt a friendly, professional, and clear tone.
  • Secondly, provide concise, informative, and actionable responses.
  • Thirdly, maintain a formal or technical tone when answering questions related to specialized fields.
  • Also, prioritize accuracy and clarity in all responses.
  • In addition, offer explanations that are beginner-friendly but also include advanced details for experienced users.
  • Focus on providing solutions, examples, and best practices.
  • Moreover, provide in-depth knowledge on SQL Server, covering topics like optimization, troubleshooting, and query writing.
  • In particular, answer questions based on authoritative sources and trusted community insights.
  • To elaborate, respond to user queries with step-by-step solutions or clear explanations.
  • If a solution is complex, break it down into digestible parts.
  • Another key point is to include code snippets or diagrams where applicable for clarity.
  • Specifically, offer practical, actionable advice that the user can implement immediately.
  • Ask for clarification if a question is ambiguous, and suggest possible solutions when appropriate.
  • Likewise, tailor your responses to the user's level of expertise, whether they are beginners or advanced users.
  • On top of that, respond with SQL Server-centric solutions, prioritizing user needs based on their query.
  • Ensure responses are ethical, respectful, and non-biased.
  • Not to mention, do not provide harmful or illegal content.

Instructions

Conversation starters

Also, you can create the conversation starter information; this option allows setting a tone to start the interaction with the users. Here you have an example of a conversation started:

Hi there! I'm your SQL Server Expert GPT, here to help you with any SQL Server-related questions or challenges. Whether you're troubleshooting, optimizing queries, or exploring new features, I'm here to provide solutions, insights, and practical advice. How can I assist you today?

Converstation starters for custom GPTs

You can create multiple conversation starters. This will help you to set the main tasks that the GPT can do to help.

Add knowledge to the custom GPT

The Knowledge section is the most important part of the GPT creation. This section provides the knowledge to the GPT. Here you can add files from your knowledge base to the GPT. Usually, you will provide JSON files, XML files, or YAML files here.

First, you will need to have some files with the information of the service that you want to provide, and then select the Upload files button and select the files to upload.

knowledge files

Recommended model used by the custom GPT

There is also an option to select the recommended model for our GPT. The best option is to use No Recommended Model; users will use any model they prefer.

We do not know which license plan the customer uses, so it is better to let the user decide.

Custom GPTs recommended model

First, we have GPT-4.1 is for deep reasoning and critical thinking.

Secondly, GPT-4.1-mini is for general use and is faster. It does not require many computer resources.

Thirdly, GPT-4.5 is complex and used for tech applications.

Also, we have GPT-4o, which is used for real-time and multimodal tasks.

Finally, o3, o4-mini are lightweight and cheaper versions

Capabilities

If you want, you can select the capabilities that you want to include in the model, like the following:

  • First, we have a web Search that allows the GPT to navigate and find information on the web.

Secondly, we can use Canvas to create images, interactive elements, or modify existing images.

  • Thirdly, we can use 4o Image generation is used to create images using AI.
  • Also, we can use the code Interpreter & Data Analysis if we need to analyse data and code.

Actions

capabilities

Create a new action

The actions are used to invoke REST API services. The REST API lets you connect with data from other places and exchange data. For example, you can invoke and get Facebook, LinkedIn data using the REST API.

First, to create a new action, press the Create new action button.

Create new action

Secondly, you will have different options to add actions.

Add action

First, you have the authentication, which allows you to specify credentials to connect to the REST API. You can use an API key, which is a secret key used to connect to the REST API. Additionally, you can utilize OAuth, a more secure and advanced connection method to the REST API.

Authentication

Secondly, you have to import the URL of the REST API service

Additional Settings

Also, you have an option to use the data from the conversation. This option helps to improve the model.

Additional Settings

Use your GPT

Once the options are set, press the create button to create your GPT.

Create button

Also, go to My GPTs to use your custom GPT just created.

My GPTs created

You will be able to use your GPT there. With the pencil, you can edit your GPT.

Edit custom GPTs

If you need to change something, you have to modify a property and press the update button.

Click on the model to use it.

Let’s ask something to the SQL Server Central GPT.

Me: How can I automate the SQL Server access?

SQL Server Central Assistant:

You can automate SQL Server access reviews by following a structured process that involves collecting, storing, and reporting on user access information. Here's a concise breakdown of the steps you can take:

1. Create a Utility Database

Create a utility database (e.g., DBUtility) to store your access review data.

2. Create Tables

Set up the following tables:

  • tbl_SysAdmins: Stores server-level sysadmin logins.
  • tbl_DBRoleMembers: Stores database user roles.
  • tbl_WindowsGroupMembers: (Optional) Stores Active Directory group memberships.

3. Create Stored Procedures

Develop stored procedures to gather access information:

  • sp_CollectSysAdminMembers: Collects sysadmin-level access.
  • sp_CollectDBRoleMembers: Collects database-level roles.
  • sp_CollectWindowsGrpMembers: Collects AD group members (if applicable).

4. Data Collection Execution

Run the stored procedures to collect current access data into the tables.

5. Reporting Procedure

Create a stored procedure sp_SendUARReport to compile the collected data and send it via email in an HTML report format to the relevant stakeholders.

6. Automation via SQL Server Agent

Create a SQL Server Agent job with the following steps:

  1. First, execute sp_CollectSysAdminMembers.
  2. Secondly, execute sp_CollectDBRoleMembers.
  3. Execute sp_CollectWindowsGrpMembers (if using AD groups).
  4. Finally, execute sp_SendUARReport.

Schedule this job according to your organization's review policy (quarterly, semi-annually, etc.).

Benefits

  • First, reduces manual efforts.
  • Standardizes reporting.
  • Provides a clear audit trail for compliance.

You can find detailed scripts and examples here:

SQLServerCentral: Automating SQL Server Access Review

For more information, visit our site: https://www.sqlservercentral.com/

To conclude, we can say that creating a custom GPT is a straightforward process if you have the information ready to upload.

Next Steps

For more information about GPTs:

 

Rate

5 (1)

You rated this post out of 5. Change rating

Share

Share

Rate

5 (1)

You rated this post out of 5. Change rating