Tuesday, February 21, 2012

running SQL file (view + procedure) problem


I am try to run a .sql file
CREATE VIEW LastReport
AS
SELECT MAX(ID) AS LastReport, RHost
FROM Report
WHERE (RComplete = 1)
GROUP BY RHost
CREATE PROCEDURE [dbo].[MembresAcces_Insert]
AS
INSERT INTO membresAcces (login, passe, id_membresTypes) VALUES ('admin','admin',50);

... 10 view and procedure like this one
i get an error view must be the first one
what is wrong ? running CREATE TABLE works perfectly
thank you


Try placing a GO in between each statement.
CREATE VIEW LastReport
AS
SELECT MAX(ID) AS LastReport, RHost
FROM Report
WHERE (RComplete = 1)
GROUP BY RHost
GO
CREATE PROCEDURE [dbo].[MembresAcces_Insert]
AS
INSERT INTO membresAcces (login, passe, id_membresTypes) VALUES ('admin','admin',50);
GO

No comments:

Post a Comment