T-SQL Tuesday #173 – Has AI Helped You with Your SQL Server Job?

This month’s T-SQL Tuesday invite comes from Pinal Dave who asks us to discuss if AI has helped with our SQL Server jobs. To read the full invite, click the T-SQL Tuesday logo.

Due to privacy concerns, I haven’t worked too much with AI helping to optimize real data but have still dipped my toe in to experiment with general SQL questions.

Error Messages

I’ve been trying to use Copilot as an alternative to Google just to see what kind of luck I have with answers. Mostly, this has been asking about an error message here and there. Sometimes it’s been helpful and pointed me in the right direction. Other times, not so much.

Recently, when working through an issue updating an Always Encrypted column, one solution given was to simply stop using Always Encrypted. Sure, that would solve my problem, but that would be quite the sledgehammer approach.

Having the sources for where the answers come from is nice to click into. If an answer doesn’t make sense, clicking into where it came from can provide better context. An answer that doesn’t make sense with your question may have been based on circumstances far different than your own.

Test Data

What I’ve liked playing around with recently is mocking up test tables and test data. Baseball season just started so let’s say I have an idea in mind for a demo that would work well with baseball data.

Without much thought, I pull up Copilot and say:

“give a create script for a SQL server table to contain baseball stats on Cleveland guardians players. also give scripts to populate the table with Cleveland guardians players”

This gives me the table along with column explanations:

And scripts for adding test data:

I want more than two players for my example, so I can ask for additional players. I tried asking for nine players, which it did successfully, but it started giving me pitchers. I got specific and asked for players with high batting averages:

“give me an insert script with the PlayerID starting at 1. give me cleveland guardians players with high batting averages.”

This type of process isn’t perfect, but it doesn’t have to be. For quickly mocking something up, it gets the job done.

Gathering Ideas

AI hasn’t helped me much in my day-to-day job yet but the potential is there. I’ll check out the other posts related to this round of T-SQL Tuesday and pick up some good tips.

Thanks for reading!

Leave a comment