相关疑难解决方法(0)

为变量赋值的SELECT语句不能与数据检索操作结合使用

这个陈述有什么问题?

ALTER Function [InvestmentReturn].[getSecurityMinLowForPeriod](@securityid int,
    @start datetime,
    @end datetime)
returns xml
begin

declare @results varchar(500)
declare @low int
declare @adjustedLow int
declare @day varchar(10)

if @end is null
begin
    set @end = getdate()
end
set @adjustedLow = (select min(adjLow) 
                        from (
                            select Low * [InvestmentReturn].[fn_getCorporateActionSplitFactor](isq.securityid, @start, convert(varchar,day, 111)) as adjLow 
                            from 
                                securityquote isq
                            where isq.securityid = @securityid and isq.day >= convert(varchar(10), @start, 111) and convert(varchar(10), @end, 111) >= isq.day
                            and low != -1 
                            ) as x)
select 
    top 1 @low …
Run Code Online (Sandbox Code Playgroud)

sql-server sql-server-2008

30
推荐指数
2
解决办法
15万
查看次数

标签 统计

sql-server ×1

sql-server-2008 ×1