语法不正确CREATE PROCEDURE必须是批处理中的唯一语句"

时间:2015-07-09 04:06:46

标签: sql-server-2008

您好我在插入更新和删除中编写单个存储过程但是错误正在进行"语法不正确CREATE PROCEDURE必须是批处理中的唯一语句"

一旦看到我的存储过程

      public List<Data> list() {
    Session session = HibHelper.getSessionFactory().openSession();
    session.beginTransaction();

    List<Data> userList = null;

    try {
        userList = (List<Data>) session.createQuery("from Data").list();

                if(!session.getTransaction.wasCommitted()){
                    session.getTransaction.commit()
                    }
    } catch (HibernateException e) {
        e.printStackTrace();
        session.getTransaction().rollback();
    }
    session.close();
    return userList;
}

1 个答案:

答案 0 :(得分:2)

缺少一个开头:

As Begin
if @Action = 'Select'
   select * from Employee 
end

应该是:

As Begin
if @Action = 'Select'
begin
   select * from Employee 
end