Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support parser SQL Server SUBSTRING function #29685

Merged
merged 2 commits into from
Jan 10, 2024
Merged

support parser SQL Server SUBSTRING function #29685

merged 2 commits into from
Jan 10, 2024

Conversation

TherChenYang
Copy link
Collaborator

Fixes #29155.

Changes proposed in this pull request:

  • Adjust CONVERT method vistor number
  • Fix LiteralExpressionSegment does not support null literals
  • support SQL in 29155

Sql case :

INSERT INTO #NonExistentTable values (10)
SELECT s.ticket, s.customer, r.store  
FROM dbo.Sales AS s  
CROSS JOIN dbo.Returns AS r  
WHERE s.ticket = r.ticket AND  
s.type = 'toy' AND  
r.date = '2016-05-11'
SELECT tat.transaction_begin_time, getdate() AS 'current time', es.program_name, es.login_time, es.session_id, tst.open_transaction_count, eib.event_info
FROM sys.dm_tran_active_transactions tat
JOIN sys.dm_tran_session_transactions tst ON tat.transaction_id=tst.transaction_id
JOIN sys.dm_exec_sessions es ON tst.session_id=es.session_id 
CROSS APPLY sys.dm_exec_input_buffer(es.session_id, NULL) eib WHERE es.is_user_process = 1
ORDER BY tat.transaction_begin_time ASC
SELECT text, 'DBCC FREEPROCCACHE (0x' + CONVERT(VARCHAR (512), plan_handle, 2) + ')' AS dbcc_freeproc_command FROM sys.dm_exec_cached_plans
CROSS APPLY sys.dm_exec_query_plan(plan_handle)
CROSS APPLY sys.dm_exec_sql_text(plan_handle)
WHERE text LIKE '%person.person%'
SELECT ProductID, Name, ProductNumber
FROM [Production].[Product]
WHERE SUBSTRING(ProductNumber, 0, 4) =  'HN-'

Before committing this PR, I'm sure that I have checked the following options:

  • My code follows the code of conduct of this project.
  • I have self-reviewed the commit code.
  • I have (or in comment I request) added corresponding labels for the pull request.
  • I have passed maven check locally : ./mvnw clean install -B -T1C -Dmaven.javadoc.skip -Dmaven.jacoco.skip -e.
  • I have made corresponding changes to the documentation.
  • I have added corresponding unit tests for my changes.

Copy link
Member

@strongduanmu strongduanmu left a comment

Choose a reason for hiding this comment

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

LGTM, merged.

@strongduanmu strongduanmu merged commit 316e802 into apache:master Jan 10, 2024
133 checks passed
@strongduanmu
Copy link
Member

Hi @TherChenYang, can you comment on the original issue? I will assign it to you.

@TherChenYang
Copy link
Collaborator Author

Hi @TherChenYang, can you comment on the original issue? I will assign it to you.

ok 👌🏻

xiaomizhou2 pushed a commit to xiaomizhou2/shardingsphere that referenced this pull request Jan 11, 2024
* Support parsing SQL Server SUBSTRING function

* fix convert function parser error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support parsing SQL Server INSERT INTO sql
2 participants