解决sql server中批处理过程中“'CREATE/ALTER PROCEDURE 必须是查询批次中的第一个语句”
2017-09-20 14:52
501 查看
-----------------------------------------line------------------------------------------------- USE [p20-cy-2966]; /* V1.0.2版本SQL批处理 */ --判断某表的某字段是否存在 if (not exists(select * from syscolumns where id=object_id('BlanceManageO2O') and name='OrderInfoNum')) ALTER TABLE BlanceManageO2O ADD OrderInfoNum INT DEFAULT 0; GO --判断某存储过程是否存在 if (exists (select * from sys.objects where name = 'sp_BlanceOrderInsertCatering')) drop proc sp_BlanceOrderInsertCatering GO CREATE PROCEDURE [dbo].[sp_BlanceOrderInsertCatering] -- 由存储过程SettlementManageO2O 中传入值 @ShopId int, @AgentId int, @BlanceId int, @IndustryId int, --行业类型 行业Id 1-零售 2-餐饮 3-酒店 4-娱乐 5-家政 6-旅游 7-二手 @Year int, --年 @Month int, --月 @Day int , --日 @O2OShopPercent decimal(18,2), --020提成百分比 @WeixinPoundaga decimal(18,2), -- 获取系统设置PlatBaseSet表中的微信支付手续费百分比 @TransferPriceSum decimal(18,2) output AS BEGIN --处理程序 END GO --判断某存储过程是否存在 if (exists (select * from sys.objects where name = 'SettlementManageCatering')) drop proc SettlementManageCatering GO CREATE PROCEDURE [dbo].[SettlementManageCatering] AS BEGIN --处理程序 END GO -----------------------------------------line------------------------------------------------- USE [p20-cy-2967]; /* V1.0.2版本SQL批处理 */ --判断某表的某字段是否存在 if (not exists(select * from syscolumns where id=object_id('BlanceManageO2O') and name='OrderInfoNum')) ALTER TABLE BlanceManageO2O ADD OrderInfoNum INT DEFAULT 0; GO --判断某存储过程是否存在 if (exists (select * from sys.objects where name = 'sp_BlanceOrderInsertCatering')) drop proc sp_BlanceOrderInsertCatering GO CREATE PROCEDURE [dbo].[sp_BlanceOrderInsertCatering] -- 由存储过程SettlementManageO2O 中传入值 @ShopId int, @AgentId int, @BlanceId int, @IndustryId int, --行业类型 行业Id 1-零售 2-餐饮 3-酒店 4-娱乐 5-家政 6-旅游 7-二手 @Year int, --年 @Month int, --月 @Day int , --日 @O2OShopPercent decimal(18,2), --020提成百分比 @WeixinPoundaga decimal(18,2), -- 获取系统设置PlatBaseSet表中的微信支付手续费百分比 @TransferPriceSum decimal(18,2) output AS BEGIN --处理程序 END GO if (exists (select * from sys.objects where name = 'SettlementManageCatering')) drop proc SettlementManageCatering GO CREATE PROCEDURE [dbo].[SettlementManageCatering] AS BEGIN --处理程序 END GO
相关文章推荐
- 'CREATE/ALTER PROCEDURE' 必须是查询批次中的第一个语句。
- sql server存储过程:错误21037: [SQL-DMO]在Text 属性的“CREATE...”语句中指定的名称必须与Name....问题解决
- 添加新记录并判断唯一时:必须是查询批次中的第一个语句
- 'CREATE FUNCTION' 必须是查询批次中的第一个语句。
- MSSQL 'CREATE/ALTER PROCEDURE' 必须是查询批次中的第一个语句。
- SQL Server 存储过程中处理多个查询条件的几种常见写法分析,我们该用那种写法
- sql server查询所有表名、字段名、类型、长度 和 存储过程、视图 的创建语句
- 在SQL Server中使用SQL语句查询一个存储过程被其它所有的存储过程引用的存储过程名
- SQL Server 查询处理中的各个阶段(SQL语句执行顺序)
- (转)jdbc 调用 sql server 的存储过程时“该语句没有返回结果集”的解决方法
- SQL Server安装过程中出现“以前的某个安装程序已在安装计算机上创建挂起的文件操作,运行程序前必须重启计算机”错误的解决方法
- 在SQL Server中使用SQL语句查询一个存储过程被其它所有的存储过程引用的存储过程名
- SQL Server 2008 中SQL查询语句中字段值不区分大小写问题处理
- SQL SERVER 2008用Select操作处理数据(一)——查询语句的语法流
- Sql Server系列:SQL语句查询数据库中表、视图、存储过程等组成
- 在SQL Server中使用SQL语句查询一个存储过程被其它所有的存储过程引用的存储过程名
- 存储过程中特殊符号的处理-sql语句当参数的存储过程-复杂查询
- 在SQL Server中使用SQL语句查询一个存储过程被其它所有的存储过程引用的存储过程名
- SQL Server 2008中SQL查询语句字段值不区分大小写的问题解决
- 连接excel执行Insert Into语句出现“操作必须使用一个可更新的查询”的解决