create proc test
@fileName varchar(255)
as
  select * from file_table where file_name=@fileName
--调用
exec test 'xxx'

解决方案 »

  1.   

    CREATE PROC Test
    @S nvarchar(20)
    AS
    select *
    from file_table 
    where file_name=@S
      

  2.   

    谢谢 
    再问一个问题
    我以前在VC中是这样打开使用的
    strSQL.Format("select *from file_table where file_name='%s'",del_filename);
    if(!OpenRecordSet(m_pRecordset,strSQL))
    {
    AfxMessageBox("没有成功打开数据表");
    return false;
    }  现在换成存储过程了 该怎么使用这个存储过程呢?
      

  3.   

    谢谢 
    再问一个问题
    我以前在VC中是这样打开使用的
    strSQL.Format("select *from file_table where file_name='%s'",del_filename);
    if(!OpenRecordSet(m_pRecordset,strSQL))
    {
    AfxMessageBox("没有成功打开数据表");
    return false;
    }  现在换成存储过程了 该怎么使用这个存储过程呢?
      

  4.   

    CString strSQL; 
    strSQL.Format("select *from file_table where file_name='%s'",del_filename); create proc pro_g
    as 
    set nocount on
    select *from file_table where file_name='%s'
    set nocount off