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

Add BULK INSERT to tsql #3861

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

JannikDeuschelQC
Copy link

Closes #3850

@teverett teverett added the tsql label Dec 1, 2023
@teverett
Copy link
Member

teverett commented Dec 1, 2023

@JannikDeuschelQC there are some merge conflicts.

Copy link
Member

@KvanTTT KvanTTT left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution and welcome ANTLR grammars repository!

But please fix review comments and add/expand examples that covers suggested changes in the examples directory.

Also, fix merge conflicts.

Copy link
Member

Choose a reason for hiding this comment

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

I guess all newly added tokens should be also added to the keyword list to allow they be identifiers if needed:

  • BATCHSIZE
  • CHECK_CONSTRAINTS
  • CODEPAGE
  • DATAFILETYPE
  • ERRORFILE
  • ERRORFILE_DATA_SOURCE
  • FIELDTERMINATOR
  • FIELDQUOTE
  • FIRE_TRIGGERS
  • FIRSTROW
  • FORMATFILE
  • FORMATFILE_DATA_SOURCE
  • KEEPNULLS
  • KILOBYTES_PER_BATCH
  • LASTROW
  • MAXERRORS
  • ROWS_PER_BATCH
  • ROWTERMINATOR

: BULK INSERT
ddl_object
FROM STRING
(WITH LR_BRACKET (bulk_insert_option (COMMA bulk_insert_option)*) RR_BRACKET)?
Copy link
Member

Choose a reason for hiding this comment

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

Remove useless parentheses:

Suggested change
(WITH LR_BRACKET (bulk_insert_option (COMMA bulk_insert_option)*) RR_BRACKET)?
(WITH LR_BRACKET bulk_insert_option (COMMA bulk_insert_option)* RR_BRACKET)?

Comment on lines +2006 to +2029
: BATCHSIZE EQUAL DECIMAL
| CHECK_CONSTRAINTS
| CODEPAGE EQUAL STRING
| DATAFILETYPE EQUAL STRING
| DATA_SOURCE EQUAL STRING
| ERRORFILE EQUAL STRING
| ERRORFILE_DATA_SOURCE EQUAL STRING
| FIRSTROW EQUAL DECIMAL
| FIRE_TRIGGERS
| FORMATFILE_DATA_SOURCE EQUAL STRING
| KEEPIDENTITY
| KEEPNULLS
| KILOBYTES_PER_BATCH EQUAL DECIMAL
| LASTROW EQUAL DECIMAL
| MAXERRORS EQUAL DECIMAL
| ORDER LR_BRACKET column_name_list_with_order RR_BRACKET
| ROWS_PER_BATCH EQUAL DECIMAL
| ROWTERMINATOR EQUAL STRING
| TABLOCK
| FORMAT EQUAL STRING
| FIELDQUOTE EQUAL STRING
| FORMATFILE EQUAL STRING
| FIELDTERMINATOR EQUAL STRING
| ROWTERMINATOR EQUAL STRING
Copy link
Member

Choose a reason for hiding this comment

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

Please extract common parts:

Suggested change
: BATCHSIZE EQUAL DECIMAL
| CHECK_CONSTRAINTS
| CODEPAGE EQUAL STRING
| DATAFILETYPE EQUAL STRING
| DATA_SOURCE EQUAL STRING
| ERRORFILE EQUAL STRING
| ERRORFILE_DATA_SOURCE EQUAL STRING
| FIRSTROW EQUAL DECIMAL
| FIRE_TRIGGERS
| FORMATFILE_DATA_SOURCE EQUAL STRING
| KEEPIDENTITY
| KEEPNULLS
| KILOBYTES_PER_BATCH EQUAL DECIMAL
| LASTROW EQUAL DECIMAL
| MAXERRORS EQUAL DECIMAL
| ORDER LR_BRACKET column_name_list_with_order RR_BRACKET
| ROWS_PER_BATCH EQUAL DECIMAL
| ROWTERMINATOR EQUAL STRING
| TABLOCK
| FORMAT EQUAL STRING
| FIELDQUOTE EQUAL STRING
| FORMATFILE EQUAL STRING
| FIELDTERMINATOR EQUAL STRING
| ROWTERMINATOR EQUAL STRING
: ( BATCHSIZE
| FIRSTROW
| KILOBYTES_PER_BATCH
| LASTROW
| MAXERRORS
| ROWS_PER_BATCH
) EQUAL DECIMAL
| ( CODEPAGE
| DATAFILETYPE
| DATA_SOURCE
| ERRORFILE
| ERRORFILE_DATA_SOURCE
| FORMATFILE_DATA_SOURCE
| ROWTERMINATOR
| FORMAT
| FIELDQUOTE
| FORMATFILE
| FIELDTERMINATOR
| ROWTERMINATOR
) EQUAL STRING
| CHECK_CONSTRAINTS
| FIRE_TRIGGERS
| KEEPIDENTITY
| KEEPNULLS
| ORDER LR_BRACKET column_name_list_with_order RR_BRACKET
| TABLOCK

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TSQL: Add BULK INSERT support
3 participants