GetIncomeWithDate '2002.06.02','','12'
                    @start_date,, @windows 
第 5 行: '.02' 附近有语法错误。

解决方案 »

  1.   

    1、@start_date 应该是VARCHAR类型,如果是日期型,应该先转换。
    2、日期型应该用''括起来. DECLARE @SQL VARCHAR(5400)
    SET @SQL='select operator,login=(select login from conduct where number=income.operator),name,
    startno,lastno,soldall=(solda+soldd+solde+soldf+soldg+soldh),priceall=
    (pricea+priced+pricee+pricef+priceg+priceh),soldb,priceb,soldc,pricec,backu,refundu,chargeu,
    voucheru,backz,refundz,personsback,backv,refundv,chargev,disuse ,b=(persons-backu-backz),
    p=(price-refundu-refundz) from income where workdate>('''+ @start_date +''') and workdate<(''' + 
    convert(char,dateadd(Day,1,convert(char,@start_date,102)),102)+''')and (solda+soldb+soldc+solde+soldf+soldg+soldh+
    backu+backz)>0 and (workid in (' + @windows + ')) order by operator'
    select @sql
    EXEC (@SQL)