自定义存储过程:
if (object_id('p_wm_get_dynstore', 'P') is not null)
drop proc p_wm_get_dynstore
go
create procedure p_wm_get_dynstore(
@stock_id int =0,
@useful_date int =0,
@i_state int =0,
@q_state int =0,
@is_batch bit = 0,
@product_code varchar(250) =''
)
-- =============================================
-- Author: XXX
-- Create date: 2016-02-18
-- Description: XXXXXXX
-- =============================================
as
begin
declare @ifstr varchar(2000) = ''
declare @newifstr varchar(2000)
declare @pro_id int
declare @sqlstr varchar(2000)
if @stock_id =0 or @stock_id is null
RaisError('传入参数错误:stock_id必填',16,1)
if @useful_date <> 0 and @useful_date is not null
Set @ifstr = @ifstr