declare @Sql nvarchar(max)
set @Sql=N'select Zone'+CAST(@i as varchar)+' from T_Tc_CustPrice where QteTypeGid=''9750F702-9368-4ABF-801B-9EFD567D7E03'' and DestPort='''+@DestPort+''''
declare @temp Table(price decimal(18,2))
insert into @temp exec(@Sql)
return (select * from @temp)
set @Sql=N'select Zone'+CAST(@i as varchar)+' from T_Tc_CustPrice where QteTypeGid=''9750F702-9368-4ABF-801B-9EFD567D7E03'' and DestPort='''+@DestPort+''''
declare @temp Table(price decimal(18,2))
insert into @temp exec(@Sql)
return (select * from @temp)
报下面的错
在函数内对带副作用的运算符 'INSERT EXEC' 的使用无效。
Sql Code:
Create FUNCTION F_GetOrderPrice
(
@OrderType varchar(20),
@Corporation_Gid varchar(50),
@DestPort varchar(30),
@GoodsWeight decimal(18,2)=NULL
)
RETURNS decimal(18,2)
AS
BEGIN
declare @temp table(price decimal(18,2))
insert into @temp exec P_GetOrderPrice @OrderType,@Corporation_Gid,@DestPort,@GoodsWeight
return (select * from @temp)
END