We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Error in stored procedures

Hi I am trying to create a simple view using a stored procedure. But everytime i try to create the procedure it is displaying an error

here is my code
***********************

USE crm
go
create procedure Update_Proc
as
begin

IF EXISTS (SELECT TABLE_NAME FROM INFORMATION_SCHEMA.VIEWS

WHERE TABLE_NAME = 'Update_View' )

DROP VIEW Update_View

GO

CREATE VIEW Update_View

AS

select compid,service_req,reg_at,reg_by,exp_time,zone,ambulance.mobile
from complaints,ambulance

go

*********************************

it is showing the following error!

incorrect syntax near Update_View

how can i resolve this

kindly help
ravi.

1 Reply

PJ Poornima Joy Balan Syncfusion Team May 2, 2007 10:02 AM UTC

Hello,

Here's the modified stored prodecure.

USE crm
go
create procedure Update_Proc
as
IF EXISTS (SELECT TABLE_NAME FROM INFORMATION_SCHEMA.VIEWS WHERE TABLE_NAME = 'Update_View' )
DROP VIEW Update_View
GO
CREATE VIEW Update_View
AS
select compid,services_req,req_at,reg_by,exp_time,zone,ambulance.mobile
from complaints,ambulance
go

Please remove the 'begin' from your stored procedure. Let me know, any further queries.

Regards,
Poornima

Loader.
Live Chat Icon For mobile
Up arrow icon