Reputation: 21
Have the following procedure and get syntax error at Update:
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
...................................................................... .
Upvotes: 2
Views: 3593
Reputation: 4069
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
Upvotes: 1
Reputation: 1474
Looks like SQL Server. You need an as
after the create procedure
. See the manual: https://msdn.microsoft.com/en-za/library/ms187926.aspx
Upvotes: 4