I'm new to sql and have the following stored procedure but when i check the syntax i keep getting the following error
Incorrect syntax near the keyword "begin".
Its probably something simple but i just can't see it.
create procedure add_policy
@policyRef int (4),
@fileRef nvarchar (50),
@linkedDoc nvarchar (50),
@policySource nvarchar (50),
@leadPerson nvarchar (50),
@writtenDate nvarchar (50),
@reviewedDate nvarchar (50)
begin
Insert into tbl_policies_sub_donna (PolicyID)
select PolicyID 'int' from inserted
INSERT INTO tbl_policy_main_donna
(Policy_Ref, File_Reference, linked_document)
VALUES( @policyRef, @fileRef, @linkedDoc )
-- I guess your policy_id is a identity field
declare @cur_id as int
select @cur_id = IDENT_CURRENT('tbl_policy_main_donna')
INSERT INTO tbl_policies_sub_donna(policy_id, Source,
Lead_Person, Date_Written, Date_Revised)
VALUES(@cur_id, @policySource, @leadPerson, @writtendate,
@revieweddate)
end
Incorrect syntax near the keyword "begin".
Its probably something simple but i just can't see it.
create procedure add_policy
@policyRef int (4),
@fileRef nvarchar (50),
@linkedDoc nvarchar (50),
@policySource nvarchar (50),
@leadPerson nvarchar (50),
@writtenDate nvarchar (50),
@reviewedDate nvarchar (50)
begin
Insert into tbl_policies_sub_donna (PolicyID)
select PolicyID 'int' from inserted
INSERT INTO tbl_policy_main_donna
(Policy_Ref, File_Reference, linked_document)
VALUES( @policyRef, @fileRef, @linkedDoc )
-- I guess your policy_id is a identity field
declare @cur_id as int
select @cur_id = IDENT_CURRENT('tbl_policy_main_donna')
INSERT INTO tbl_policies_sub_donna(policy_id, Source,
Lead_Person, Date_Written, Date_Revised)
VALUES(@cur_id, @policySource, @leadPerson, @writtendate,
@revieweddate)
end