How to create your custom GPT SQL Expert

If you opened this post, you have probably seen some of Wes Osborn’s posts of Polaris SQL written with the aid of ChatGPT.  Now personally, I have no plans to use AI to write any code due to my Luddite leanings, but recognizing the potential value of this article on SQLServerCentral to many readers of the IUG Forum, I post this invitation to willingly submit to your electronic overlords. :sunglasses:

2 Likes

The custom GPT instructions they provide are OK (the image instructions are a bit cringy), here are a few suggestions I might add:

  • Include the platform you’re running against. For example, say to optimize the query for use in a Microsoft SQL 2022 Environment.
  • Ask it to be clear if it is doing anything other than reading data from the system. You could say, for example: “Always execute any changes within the context of a SQL Transaction. Provide me with a sample of the data before & after the change.”
  • Provide the custom GPT with any documentation or examples you have. If you include any documentation, you can instruct it to only use table names that are present in the documentation.

I find in general that if you can setup some of these GPT instructions you can produce code that has all the features you know you should always add to your code (including documentation) but that when you’re in a hurry you tend to skip.

I heard someone say the other day that LLMs are like having the most competent intern you can imagine on day one. The challenge is that typically they stay at that same level of competency, barring any significant model leaps, which happen every 12 months or so, and you then have to adapt around their styles to get the most out of them.

I’m still formulating a vibe coding session for IUG 2026.

PS I primarily use Gemini 2.5 Pro for my SQL coding. Not because I’m a ChatGPT hater, but because it comes bundled with another Google subscription I have.

4 Likes