Getting error using EXECUTE('UPDATE..') on a MySQL server from SQL Server -
i intend do:
execute('update tablea set campaignkey = ''20170101'' where storekey = 16 and campaignkey ''%,%''') @ mylinkedserver but error that:
you have error in sql syntax; [...] right syntax use near 'where storekey = 16 , campaignkey '%,%''
does have idea wrong? me seems might have 1 ' many on like statement, have used '' indicate non-numeric value. don't want fiddle prevent updating far many values on server.
campaignkey non-numeric (i believe varchar) , storekey integer.
edit
i must not use openquery() because not set correctly, , urgent update.
edit 2
seems because of apostrophes 's in execute statement.
when conduct:
select * openquery(linkedserver,'select * tablea storekey = 16 , campaignkey = ''20170826,151''') it works, when using:
execute('select * tablea where storekey = 16 and campaignkey = ''20170826,151''') @ linkedserver i error need check manual where clause. googling appears correct syntax in fact is:
execute('update tablex set stringvar = ''stringvalue'' intvar = 3 , stringvar = ''xxxxx''') @ linkedserver i don't know why won't work me.. have tried many combinations of '', '" etc.
what one?
update openquery(linkedserver,'select * tablea storekey = 16 , campaignkey = ''20170826,151''') set campaignkey = '20170101'
Comments
Post a Comment