transparent
Programmer
The following code works fine:
CREATE PROCEDURE usp_news_delete
@news_id int
AS
-- Remove News/Document association
DELETE FROM tbl_document_news_intersect where news_id=@news_id
-- Remove News/Category Intersect
DELETE FROM tbl_news_category_intersect where news_id=@news_id
GO
However the following returns the error "Error 137: Must declare the variable @news_id"
CREATE PROCEDURE usp_news_delete
@news_id int
AS
-- Remove News/Document association
DELETE FROM tbl_document_news_intersect where news_id=@news_id
-- Remove News/Category Intersect
DELETE FROM tbl_news_category_intersect where news_id=@news_id
GO
-- Remove News/Department Intersect
DELETE FROM tbl_news_department_intersect where news_id=@news_id
GO
-- Remove News
DELETE FROM tbl_news where news_id=@news_id
GO
Its as if the stored procedure 'forgets' the name news_id variable after two uses!
Any ideas whats going wrong?
CREATE PROCEDURE usp_news_delete
@news_id int
AS
-- Remove News/Document association
DELETE FROM tbl_document_news_intersect where news_id=@news_id
-- Remove News/Category Intersect
DELETE FROM tbl_news_category_intersect where news_id=@news_id
GO
However the following returns the error "Error 137: Must declare the variable @news_id"
CREATE PROCEDURE usp_news_delete
@news_id int
AS
-- Remove News/Document association
DELETE FROM tbl_document_news_intersect where news_id=@news_id
-- Remove News/Category Intersect
DELETE FROM tbl_news_category_intersect where news_id=@news_id
GO
-- Remove News/Department Intersect
DELETE FROM tbl_news_department_intersect where news_id=@news_id
GO
-- Remove News
DELETE FROM tbl_news where news_id=@news_id
GO
Its as if the stored procedure 'forgets' the name news_id variable after two uses!
Any ideas whats going wrong?