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.
Up arrow icon