Skip to content

Cannot use parameter name more than once in a script #422

Description

@xperiandri

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions