请执行以下步骤并在更新时出现语法错误:
USE [OTIDatabaseNewOutreach_V3.2.0_BESQL]
GO
/****** Object: StoredProcedure [dbo].[usp_OTIDataImportConstruction_U] Script Date: 5/12/2016 8:44:18 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[usp_OTIDataImportConstruction_U]
UPDATE dbo.[OTI Trainer Data Import]
SET [Construction Industry Card #] = IsNull([c_cardnumberissued],[TrainerIDNumber]),
[Construction Date Issued] = [tblCourse].[c_enddate]
from tblCourse
inner JOIN dbo.tblCourseToStudent ON dbo.tblCourse.c_id = dbo.tblCourseToStudent.c_id
INNER JOIN
dbo.[OTI Trainer Data Import] ON dbo.tblCourseToStudent.t_id = dbo.[OTI Trainer Data Import].t_id
WHERE (c_program ='construction') AND (c_expdate>GetDate());
go
............................................... ........................
答案 0 :(得分:4)
看起来像SQL Server。 as
后需要create procedure
。请参阅手册:https://msdn.microsoft.com/en-za/library/ms187926.aspx
答案 1 :(得分:1)
USE [OTIDatabaseNewOutreach_V3.2.0_BESQL] GO /****** Object: StoredProcedure [dbo].[usp_OTIDataImportConstruction_U] Script Date: 5/12/2016 8:44:18 AM ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO
CREATE PROCEDURE [dbo].[usp_OTIDataImportConstruction_U]
AS
BEGIN
UPDATE dbo.[OTI Trainer Data Import]
SET [Construction Industry Card #] = IsNull([c_cardnumberissued],[TrainerIDNumber]),
[Construction Date Issued] = [tblCourse].[c_enddate]
from tblCourse
inner JOIN dbo.tblCourseToStudent ON dbo.tblCourse.c_id = dbo.tblCourseToStudent.c_id INNER JOIN
dbo.[OTI Trainer Data Import] ON dbo.tblCourseToStudent.t_id = dbo.[OTI Trainer Data Import].t_id
WHERE (c_program ='construction') AND (c_expdate>GetDate());
END
GO