René's URL Explorer Experiment


Title: TRIM with FROM clause in RETURN statement fails to parse · Issue #188 · microsoft/SqlScriptDOM · GitHub

Open Graph Title: TRIM with FROM clause in RETURN statement fails to parse · Issue #188 · microsoft/SqlScriptDOM

X Title: TRIM with FROM clause in RETURN statement fails to parse · Issue #188 · microsoft/SqlScriptDOM

Description: Summary ScriptDom fails to parse valid T-SQL when TRIM function with FROM clause is used inside a RETURN statement. The same syntax parses correctly in SELECT or SET statements. Version Microsoft.SqlServer.TransactSql.ScriptDom: 170.157....

Open Graph Description: Summary ScriptDom fails to parse valid T-SQL when TRIM function with FROM clause is used inside a RETURN statement. The same syntax parses correctly in SELECT or SET statements. Version Microsoft.S...

X Description: Summary ScriptDom fails to parse valid T-SQL when TRIM function with FROM clause is used inside a RETURN statement. The same syntax parses correctly in SELECT or SET statements. Version Microsoft.S...

Opengraph URL: https://github.com/microsoft/SqlScriptDOM/issues/188

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"TRIM with FROM clause in RETURN statement fails to parse","articleBody":"## Summary\n\nScriptDom fails to parse valid T-SQL when `TRIM` function with `FROM` clause is used inside a `RETURN` statement. The same syntax parses correctly in `SELECT` or `SET` statements.\n\n## Version\n\nMicrosoft.SqlServer.TransactSql.ScriptDom: 170.157.0\n\n## Steps to Reproduce\n\nParse the following valid T-SQL:\n\n```sql\nCREATE FUNCTION dbo.TrimTest(@str NVARCHAR(MAX))\nRETURNS NVARCHAR(MAX)\nAS\nBEGIN\n    RETURN TRIM('x' FROM @str);\nEND\n```\n\n## Expected Result\n\nThe SQL should parse successfully, as it is valid T-SQL syntax that executes correctly on SQL Server.\n\n## Actual Result\n\nParse error: `Incorrect syntax near 'TRIM'.`\n\n## Error Messages\n\n```\nLine 5, Column 12: Incorrect syntax near 'TRIM'.\n```\n\n## Additional Information\n\nThis issue affects all `TRIM` variations using the `FROM` clause inside a `RETURN` statement:\n\n| Case | RETURN | SELECT / SET |\n|------|--------|--------------|\n| `TRIM(@str)` | OK | OK |\n| `TRIM('x' FROM @str)` | FAIL | OK |\n| `TRIM(NCHAR(12288) FROM @str)` | FAIL | OK |\n| `TRIM(LEADING ... FROM @str)` | FAIL | OK |\n| `TRIM(TRAILING ... FROM @str)` | FAIL | OK |\n| `TRIM(BOTH ... FROM @str)` | FAIL | OK |\n\n### Workaround\n\nUsing a variable as an intermediate step parses successfully:\n\n```sql\nCREATE FUNCTION dbo.TrimTest(@str NVARCHAR(MAX))\nRETURNS NVARCHAR(MAX)\nAS\nBEGIN\n    DECLARE @result NVARCHAR(MAX);\n    SET @result = TRIM('x' FROM @str);\n    RETURN @result;\nEND\n```\n\n### Minimal Reproduction Code\n\n```csharp\nusing Microsoft.SqlServer.TransactSql.ScriptDom;\n\nvar sql = \"\"\"\n    CREATE FUNCTION dbo.Test(@str NVARCHAR(MAX))\n    RETURNS NVARCHAR(MAX)\n    AS\n    BEGIN\n        RETURN TRIM('x' FROM @str);\n    END\n    \"\"\";\n\nvar parser = new TSql170Parser(initialQuotedIdentifiers: false);\nusing var reader = new StringReader(sql);\nparser.Parse(reader, out var errors);\n\nforeach (var e in errors)\n    Console.WriteLine($\"Line {e.Line}, Col {e.Column}: {e.Message}\");\n```\n\nTested with both TSql160Parser and TSql170Parser - same result.\n","author":{"url":"https://github.com/masmgr","@type":"Person","name":"masmgr"},"datePublished":"2026-02-03T04:07:14.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/188/SqlScriptDOM/issues/188"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:10dc6774-6a43-ec40-f46a-43607a6447ca
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idB468:7BEBA:EC3B1C:134B23B:698EC74D
html-safe-noncef0b5115bc230d1ef9ae1fc82e131d6e433d0a862b2887b6c44fbc000df9bb68e
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCNDY4OjdCRUJBOkVDM0IxQzoxMzRCMjNCOjY5OEVDNzREIiwidmlzaXRvcl9pZCI6IjU2NDEzNzY4NzI5MDQxODE1ODEiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmacb8f7ab87c05e2c03e6ad4d8328b3a1efddd3f884845fe68a734c4d4039d35d1c
hovercard-subject-tagissue:3888994261
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/microsoft/SqlScriptDOM/188/issue_layout
twitter:imagehttps://opengraph.githubassets.com/dd77d8f709d48928ff0d5c85453fb0b7953080e28faae1345135d1528ecf2045/microsoft/SqlScriptDOM/issues/188
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/dd77d8f709d48928ff0d5c85453fb0b7953080e28faae1345135d1528ecf2045/microsoft/SqlScriptDOM/issues/188
og:image:altSummary ScriptDom fails to parse valid T-SQL when TRIM function with FROM clause is used inside a RETURN statement. The same syntax parses correctly in SELECT or SET statements. Version Microsoft.S...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamemasmgr
hostnamegithub.com
expected-hostnamegithub.com
Nonecb2828a801ee6b7be618f3ac76fbf55def35bbc30f053a9c41bf90210b8b72ba
turbo-cache-controlno-preview
go-importgithub.com/microsoft/SqlScriptDOM git https://github.com/microsoft/SqlScriptDOM.git
octolytics-dimension-user_id6154722
octolytics-dimension-user_loginmicrosoft
octolytics-dimension-repository_id543316377
octolytics-dimension-repository_nwomicrosoft/SqlScriptDOM
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id543316377
octolytics-dimension-repository_network_root_nwomicrosoft/SqlScriptDOM
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releasee6b91a7e6e46287d26887e3fb7a4161657bab8f7
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/microsoft/SqlScriptDOM/issues/188#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2FSqlScriptDOM%2Fissues%2F188
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2FSqlScriptDOM%2Fissues%2F188
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=microsoft%2FSqlScriptDOM
Reloadhttps://github.com/microsoft/SqlScriptDOM/issues/188
Reloadhttps://github.com/microsoft/SqlScriptDOM/issues/188
Reloadhttps://github.com/microsoft/SqlScriptDOM/issues/188
microsoft https://github.com/microsoft
SqlScriptDOMhttps://github.com/microsoft/SqlScriptDOM
Notifications https://github.com/login?return_to=%2Fmicrosoft%2FSqlScriptDOM
Fork 37 https://github.com/login?return_to=%2Fmicrosoft%2FSqlScriptDOM
Star 233 https://github.com/login?return_to=%2Fmicrosoft%2FSqlScriptDOM
Code https://github.com/microsoft/SqlScriptDOM
Issues 54 https://github.com/microsoft/SqlScriptDOM/issues
Pull requests 1 https://github.com/microsoft/SqlScriptDOM/pulls
Actions https://github.com/microsoft/SqlScriptDOM/actions
Projects 0 https://github.com/microsoft/SqlScriptDOM/projects
Models https://github.com/microsoft/SqlScriptDOM/models
Security 0 https://github.com/microsoft/SqlScriptDOM/security
Insights https://github.com/microsoft/SqlScriptDOM/pulse
Code https://github.com/microsoft/SqlScriptDOM
Issues https://github.com/microsoft/SqlScriptDOM/issues
Pull requests https://github.com/microsoft/SqlScriptDOM/pulls
Actions https://github.com/microsoft/SqlScriptDOM/actions
Projects https://github.com/microsoft/SqlScriptDOM/projects
Models https://github.com/microsoft/SqlScriptDOM/models
Security https://github.com/microsoft/SqlScriptDOM/security
Insights https://github.com/microsoft/SqlScriptDOM/pulse
New issuehttps://github.com/login?return_to=https://github.com/microsoft/SqlScriptDOM/issues/188
New issuehttps://github.com/login?return_to=https://github.com/microsoft/SqlScriptDOM/issues/188
TRIM with FROM clause in RETURN statement fails to parsehttps://github.com/microsoft/SqlScriptDOM/issues/188#top
sql-featurehttps://github.com/microsoft/SqlScriptDOM/issues?q=state%3Aopen%20label%3A%22sql-feature%22
https://github.com/masmgr
https://github.com/masmgr
masmgrhttps://github.com/masmgr
on Feb 3, 2026https://github.com/microsoft/SqlScriptDOM/issues/188#issue-3888994261
sql-featurehttps://github.com/microsoft/SqlScriptDOM/issues?q=state%3Aopen%20label%3A%22sql-feature%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.