IF OBJECT_ID('*[dbo].[UpdateData]*', 'U') IS NULL
BEGIN
CREATE PROC [dbo].[UpdateData]
AS
UPDATE [DB1].[dbo].[Staff]
SET
[Name1]= 'Value1',
[Name2]= 'N2',
[Name3]= 'N3'
FROM [DB1].[dbo].[Staff] s
LEFT OUTER JOIN [DB1].[dbo].[Table1] si on s.[ID]=si.[ID]
RETURN;
END
有没有人知道为什么上面的代码片段会在UPDATE附近生成"不正确的语法,期望外部"在UPDATE [DB1].[dbo].[Staff]
答案 0 :(得分:-1)
像这样更改更新查询
UPDATE [DB1].[dbo].[Staff]
SET
[Name1]= s.[BPNumber],
[Name2]= 'N2',
[Name3]= 'N3'
FROM [DB1].[dbo].[Staff] s
LEFT OUTER JOIN [DB1].[dbo].[Table1] si on s.[ID]=si.[ID]