this simple code is causing the sp to not compile with all sorts of errors : all i am trying to do is check this table at the customer site if its empty then we don't display the app.
if (select count(*) from oen.dbd_c_modules) > 0 begin
insert into [OEN].[DBD_C_MODULES]([MODULE_ID], [DESCRIPTION], ACTIVE)
VALUES(11,'Medications',1)
end
go
errors: Msg 102, Level 15, State 1, Procedure DBD_GET_MEDICINE, Line 24 Incorrect syntax near 'end'. Msg 137, Level 15, State 2, Line 15 Must declare the scalar variable "@DATEFROM". Msg 137, Level 15, State 2, Line 16 Must declare the scalar variable "@DATEFROM". Msg 137, Level 15, State 2, Line 39 Must declare the scalar variable "@FACILITYKEY". Msg 156, Level 15, State 1, Line 52 Incorrect syntax near the keyword 'AND'. Msg 156, Level 15, State 1, Line 56 Incorrect syntax near the keyword 'AND'.
code: is here: http://www.mediafire.com/?16qr8xaszq025b6