Skip to content

Fix: error while inserting #tuning_recommendations#771

Merged
erikdarlingdata merged 1 commit intoerikdarlingdata:devfrom
ClaudioESSilva:patch-2
Apr 28, 2026
Merged

Fix: error while inserting #tuning_recommendations#771
erikdarlingdata merged 1 commit intoerikdarlingdata:devfrom
ClaudioESSilva:patch-2

Conversation

@ClaudioESSilva
Copy link
Copy Markdown
Contributor

Fixes #767

Add TRY_CAST as bigint to avoid conversion failure after parsing the JSON from the sys.dm_db_tuning_recommendations

Add TRY_CAST as bigint to avoid conversion failure after parsing the JSON from the sys.dm_db_tuning_recommendations
Copy link
Copy Markdown
Owner

@erikdarlingdata erikdarlingdata left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Claudio — verified locally that the WHERE-clause TRY_CAST resolves the conversion error path. Approving and merging.

@erikdarlingdata erikdarlingdata merged commit 3a63bb6 into erikdarlingdata:dev Apr 28, 2026
5 checks passed
erikdarlingdata added a commit that referenced this pull request Apr 29, 2026
The string-split path that parses sys.dm_db_tuning_recommendations.details
returns regressed_plan_id / recommended_plan_id with a leading space
because the upstream REPLACE chain inserts ': ' after every colon. The
implicit cast on insert into #tuning_recommendations was silently
swallowing the space; #771 added a TRY_CAST in the WHERE clause to
survive the same surface.

Move the type intent to the projection: TRY_CAST(LTRIM(SUBSTRING(...)) AS
bigint) so the columns leave the derived table already typed. Drops the
redundant TRY_CAST from the WHERE clause. Doesn't touch the splitting
math.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants