fsprojects / fsprojects/FSharp.Data.SqlClient

Cannot use parameter name more than once in a script

Open
#422 3 comments 0 reactions 1 assignee View on GitHub

@smoothdeveloper is already working on this.

Since Aug 28, 2022.

bug
Dominant language
F#
Stars
206
Forks
66
PR merge metrics
No merged PRs in 30d

Description

Issue Summary

When I try to use @assetId twice error is displayed

    MERGE INTO [dbo].[AssetName] AS Target
    USING (VALUES
      (@assetId, 11, @ukrainianName, 5, N'Afroz Yadwad'),
      (@assetId, 10, @russianName, 4, N'Afroz Yadwad')
    ) AS Source ([AssetId],[LanguageId],[InternalName],[OrderBy],[CreatedBy])
    ON  Target.[AssetId] = Source.[AssetId]
    AND Target.[LanguageId] = Source.[LanguageId]

    WHEN NOT MATCHED BY TARGET THEN
        INSERT ([AssetId],[LanguageId],[InternalName],[OrderBy],[CreatedBy])
        VALUES ([AssetId],[LanguageId],[InternalName],[OrderBy],[CreatedBy])

    WHEN MATCHED THEN
        UPDATE SET TARGET.[InternalName] = Source.[InternalName]
    ;
Error

Incorrect syntax near 5

Expected behavior

The parameter name is reused and can be referenced more than once

What you can do
  • I am willing to contribute a PR with a unit test showcasing the issue
  • I am willing to test the bug fix before the next release

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.