有,可以有默认值create proc proc_a @re1 varchar(20),@re2 int = 0
as  //
go@re2在使用时可以不付值

解决方案 »

  1.   

    A. 创建使用参数的存储过程
    下例创建一个在 pubs 数据库中很有用的存储过程。给出一个作者的姓和名,该存储过程将显示该作者的每本书的标题和出版商。CREATE PROC au_info @lastname varchar(40), @firstname varchar(20) 
    AS 
    SELECT au_lname, au_fname, title, pub_name
    FROM authors INNER JOIN titleauthor ON authors.au_id = titleauthor.au_id
       JOIN titles ON titleauthor.title_id = titles.title_id
       JOIN publishers ON titles.pub_id = publishers.pub_id
    WHERE au_fname = @firstname
    AND au_lname = @lastname
    GOB. 创建使用参数默认值的存储过程
    下例创建一个存储过程 pub_info2,该存储过程显示作为参数给出的出版商所出版的某本书的作者姓名。如果未提供出版商的名称,该存储过程将显示由 Algodata Infosystems 出版的书籍的作者。CREATE PROC pub_info2 @pubname varchar(40) = 'Algodata Infosystems'
    AS 
    SELECT au_lname, au_fname, pub_name
    FROM authors a INNER JOIN titleauthor ta ON a.au_id = ta.au_id
       JOIN titles t ON ta.title_id = t.title_id
       JOIN publishers p ON t.pub_id = p.pub_id
    WHERE @pubname = p.pub_name更详细内容清看sql server联机帮助!