我被困在将参数传递给OPENDATASOURCE并收到错误消息:
消息102,'SQLNCLI'附近的语法不正确
---- @ ConnectionString从UI传递
IF EXISTS(SELECT CM.CustomerId AS [Customer ID] from CardMaster CM inner join CUSTOMERTAIL CT
on CM.CustomerId = CT.CustomerId
INNER JOIN OPENDATASOURCE(SQLNCLI, @ConnectionString).MercFuelProd.dbo.CUSTOMER CR
ON CM.CustomerId = CR.CUSTID WHERE CM.CardNumber = @CardNumber) -
BEGIN
SET @Result = 'SUCCESS'
END
ELSE
请任何人帮我解决这个问题。
答案 0 :(得分:0)
你必须传递字符串:
OPENDATASOURCE('SQLNCLI'...
https://msdn.microsoft.com/en-us/library/ms179856.aspx
此外,您在BEGIN
关键字...