Moniker131 To escape the /*
in your dynamic SQL query, you can use the CHAR
function to insert the ASCII code for the forward slash and asterisk characters. Here's an example:
SET @path = 'https://' + @storageaccountname + '.endpoint/container/folder/' + CHAR(47) + CHAR(42) + '.csv'
SET @sql = 'COPY INTO myTable FROM ''' + @path + ''' WITH (FORMAT=''CSV'')'
EXEC (@sql)
In this example, CHAR(47)
inserts the ASCII code for the forward slash character, and CHAR(42)
inserts the ASCII code for the asterisk character. This will allow you to use the wildcard in your path without it being interpreted as a comment block.