以下命令显示了在指定的数据库中,如何创建存储过程. 特别注意创建之前的删除处理 USE pubs IF EXISTS (Select name FROM sysobjects Where name = 'au_info_all' AND type = 'P') Drop PROCEDURE au_info_all GO Create PROCEDURE au_info_all AS Select au_lname, au_fname, title, pub_name FROM authors a INNER JOIN titleauthor ta ON a.au_id = ta.au_id INNER JOIN titles t ON t.title_id = ta.title_id INNER JOIN publishers p ON t.pub_id = p.pub_id GO au_info_all 存储过程可以通过以下方法执行: EXECUTE au_info_all -- or EXEC au_info_all (责任编辑:IT) |