I used Claude to build an application that loaded data for me. However, there were a few others things I needed done to help me get the data ready for analysis. I could have used Claude (or another human), but this was a place I’d need to do a lot of directing.
I did, however, use Prompt AI to help me get this moving quicker and start some analysis. This post covers the way I got assistance inside SSMS from Prompt AI.
This is part of a series of posts on SQL Prompt. You can see all my posts on SQL Prompt under that tag. This is part of a series of experiments with AI systems.
Adding New Structures
As a part of my data analysis, I needed to tag sessions with topics. This wasn’t really done as a part of most SQL Saturday events. While there might be tracks, often the sessions aren’t categorized with tags. It’s a pain, most organizers and most speakers don’t want to bother.
Plus, search works well on a website. For data analysis, not so much.
I decided to use Prompt AI to help a bit at this point, since I was low on credits.
I asked it to add a structure. Possibly I could have written the code in not much more time than it took for this prompt, but here I get to let an assistant take a stab and then critique the work. Here’s my prompt to SQL Prompt AI:
Here are the results. This has the PKs, FKs, and indexes, some of which I might have forgotten. I don’t love names like “description”, but that’s fine. I could easily fix that.
-- Create a table to store tags
CREATE TABLE dbo.Tags
(
TagID INT IDENTITY(1, 1) PRIMARY KEY,
TagName NVARCHAR(100) NOT NULL,
Description NVARCHAR(500) NULL,
CreatedDate DATETIME
DEFAULT GETDATE()
);
-- Create a junction table to link sessions with tags (many-to-many relationship)
CREATE TABLE dbo.SessionTags
(
SessionID INT NOT NULL,
TagID INT NOT NULL,
PRIMARY KEY (
SessionID,
TagID
),
CONSTRAINT FK_SessionTags_Sessions
FOREIGN KEY (SessionID)
REFERENCES dbo.Sessions (SessionID),
CONSTRAINT FK_SessionTags_Tags
FOREIGN KEY (TagID)
REFERENCES dbo.Tags (TagID)
);
-- Create index to improve query performance
CREATE INDEX IX_SessionTags_TagID ON dbo.SessionTags (TagID);
CREATE INDEX IX_SessionTags_SessionID ON dbo.SessionTags (SessionID);
Now, I need to analyze the data.
Fortunately, Prompt AI helped me. Below this DDL, was a snippet to test my tags. I had this code listed:
SELECT
s.SessionID,
s.Title,
STRING_AGG(t.TagName, ', ') AS Tags
FROM
dbo.Sessions s
LEFT JOIN
dbo.SessionTags st ON s.SessionID = st.SessionID
LEFT JOIN
dbo.Tags t ON st.TagID = t.TagID
--WHERE Title LIKE '%n rds%'
GROUP BY
s.SessionID, s.Title;
I used this to check my tags, which were non existent at this point, so I had all NULL values in the Tags column. Fortunately, I know how to write some code, so in another window I wrote this code, which inserts data, but doesn’t create dups since I might have dups based on my LIKE clause catching the same session twice.
I also get the list of current tags, so I could change the number used in the insert as needed. There are more elegant ways to do this, but I wanted to get something done.
INSERT dbo.SessionTags
(
SessionID,
TagID
)
SELECT SessionID, 10
FROM sessions WHERE Title LIKE '%n rds%'
AND sessionid NOT IN (SELECT sessionid
FROM dbo.SessionTags
WHERE TagID = 10)SELECT @@rowcount
GO
SELECT top 30
*
FROM dbo.Tags
There was a sample INSERT statement for tags as well, so I modified it to use tags I cared about. Then I started running my test query to look for NULL values and start filling them in.
Here’s a look at a run. I’ve added some tags, but there are some nulls. There are also multiple tags for some sessions. I added the description field as well, but for most of the data, this doesn’t exist, so I don’t have it. Yet. That’s another project.
Line 63 is for Snowflake, which isn’t a tag. So I edit my commented out code to include Snowflake and then execute it. This is commented, so as I hit execute it doesn’t run automatically.
Now I get a list of tags and use that to edit my numbers in the SessionTags insert statement. In this case, Snowflake is number 17, so I change the insert to that, and edit the LIKE statement. This will add that tag to all sessions with Snowflake in the title.
I repeated this for a number of sessions. Below, I’ve re-run my tag query and now we see Snowflake is added.
Why I Didn’t Use an AI for This
I built an application that loaded this data with Claude Code. I could have asked Claude to add the tags as well, but I didn’t have any data to put in there. I wasn’t even sure what I would do, especially as a lot of these sessions aren’t really sessions. Notice the timings above, the breaks, the panels, etc. There are also lunch breaks and other items that aren’t really sessions.
Claude could have cleaned this data. However, I want to be sure of what I’m removing. Having Claude write the delete (or run a select first) and then ask me what to do doesn’t seem to be a good use of its cost or my time.
I still need to be the human in the loop. There were some times I ran a select for certain words and then check the list before adding the tags. For example, here was what I did for Snowflake.
All those are good, but when I ran a search for Agent, I found mostly AI based results, but a few were SQL Agent sessions. Tagging those as AI wouldn’t make sense, so I had to find a better way to update the data I needed updating.
Summary
Prompt didn’t do a lot here, but it did quickly get me moving on the task I was focused on rather than the details to support it. I could have written the DDL, but it would have taken focus away from me in thinking about tags. This did as good a job as I could do, or more importantly, as good a job as I needed.
It also gave me a query and insert statement to get moving, again, reducing my mental load. I could have written that query, but I would have spent a few minutes doing it rather than thinking about how to assign tags.
Ultimately I think this was a good use of AI, saving my time and energy, allowing me to focus on the task I was trying to accomplish without distraction.

