如题,谢谢!

解决方案 »

  1.   

    select 1 from dbo.sysobjects t where t.name='存储过程名字'
      

  2.   

    dbo.sysobjects 是系统表吗?在sql 2005中怎么没找到?
      

  3.   

    public static bool IsStoredProcExisting(SqlConnection conn, string procName)
            {
                bool result = false;
                conn.Open();
                SqlCommand command = conn.CreateCommand();
                command.CommandText = "SELECT name FROM sysobjects WHERE  xtype = 'P' and name = @name";
                command.Parameters.Add("@name", procName);
                object temp = command.ExecuteScalar();
                result = temp != null;
                conn.Close();
                return result;
            }
      

  4.   

    运行到:object temp = command.ExecuteScalar();出错提示:列名 'procName' (存储过程名)无效。什么原因哦?
      

  5.   

    public static bool IsStoredProcExisting(SqlConnection conn, string procName)
            {
                bool result = false;
                conn.Open();
                SqlCommand command = conn.CreateCommand();
                command.CommandText = "SELECT name FROM sysobjects WHERE  xtype = 'P' and name = @name";
                command.Parameters.Add("@name", procName);
                object temp = command.ExecuteScalar();
                result = temp != null;
                conn.Close();
                return result;
            }
    这个就可以了