dnlnln / generate-sql-merge

Generate SQL MERGE statements with Table data

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error Occurs When Verifying the Existence of the 'hashedvalue' Column

q0-0n opened this issue · comments

commented

Issue Description:
When attempting to add a 'Hashvalue' column on an Azure SQL Database called [database-with-a-hyphen], an error occurs if the database name contains hyphens. The error can be traced back to the following line:

https://github.com/readyroll/generate-sql-merge/blob/9e9ddd2472317d54d9a45ec81aaff5b3aa0131dc/master.dbo.sp_generate_merge.sql#L326

Suggested Solution:
To mitigate this issue, it is recommended to enclose the database name using the QUOTENAME() function. This helps prevent syntax errors from arising during the execution of the SQL statement.

Thanks for the report, the issue is now fixed.

Just for context, the issue occurred on all SQL editions, i.e. both on-premise and Azure SQL.