CREATE EXTERNAL TABLE with filepath() or filename() calculated column gives syntax error
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
Research direction
Use the supplied CREATE EXTERNAL TABLE statement with filepath() and filename() as the reproduction case, and first run it through the ScriptDOM parser to confirm where the syntax error is reported. Inspect the parser and grammar support for calculated columns in external tables, then add regression coverage showing that the valid SQL parses successfully.
Written by the indexing model from the issue text.
Description
CREATE EXTERNAL TABLE [stg].[my_table] (
[COLUMN_ONE] VARCHAR (50) NULL,
[filepath] AS CAST(filepath() AS NVARCHAR(1024)),
[filename] AS CAST(filename() AS NVARCHAR(1024))
)
WITH (
DATA_SOURCE = [DataSource1],
LOCATION = N'somepath/somefile*.csv',
FILE_FORMAT = [TildeDelimitedQuoted_CSV],
REJECT_TYPE = VALUE,
REJECT_VALUE = 0
);
The above is valid and runs in SQL Managed Instance but in VS 2022 with latest updates I get
Incorrect Syntax near 'AS'
This is a problem for us and we are having to revert to using views with OPENQUERY rather than external tables as we need the filepath and filename in the external table resultset.
I hope this is the right place to raise this !
- Dominant language
- GAP
- Stars
- 277
- Forks
- 43
- Avg merge
- 6d 17h
- Merged PRs (30d)
- 3
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from microsoft/SqlScriptDOM
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
microsoft/SqlScriptDOM#228 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
microsoft/SqlScriptDOM#183 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 56/100
microsoft/SqlScriptDOM#226 · 1 reaction ·
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
microsoft/SqlScriptDOM#225 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 58/100
microsoft/SqlScriptDOM#224 ·
All issues in microsoft/SqlScriptDOM
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
oxc-project/oxc#26944 ·
-
todo:perf
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
bug
Difficulty 2/5 Half a day Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
tenstorrent/tt-metal#57393 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
objectionary/eo#8894 ·