select @CountAll = count(*) from SupplyAndDemandInfo
select @TodayCount = count(*) from SupplyAndDemandInfo 
where datetime = convert(char(4),YEAR (getdate()))+rtrim(convert(char(2),month(getdate())))+rtrim(convert(char(2),day(getdate())))

解决方案 »

  1.   

    Create Procedure Temp_SupplyAndDemandInfo_Count
    @CountAll int OUTPUT,
    @TodayCount int OUTPUT
    AS
       select @CountAll = count(*) from SupplyAndDemandInfo
       select @TodayCount = count(*) from SupplyAndDemandInfo 
       where datetime = convert(char(4),YEAR (getdate()))+rtrim(convert(char(2),month(getdate())))+rtrim(convert(char(2),day(getdate())))
      

  2.   

    Create Procedure Temp_SupplyAndDemandInfo_Count
    @CountAll int OUTPUT,
    @TodayCount int OUTPUT
    AS
    set nocount on
    begin  
      select @CountAll = count(*) from SupplyAndDemandInfo
       select @TodayCount = count(*) from SupplyAndDemandInfo 
       where [datetime] =convert(char(8),getdate(),112)
    end
      

  3.   

    Create Procedure Temp_SupplyAndDemandInfo_Count
    @CountAll int OUTPUT,
    @TodayCount int OUTPUT
    AS
      select @CountAll = count(*) from SupplyAndDemandInfo
      select @TodayCount = count(*) from SupplyAndDemandInfo 
       where datetime = getdate()
      

  4.   

    Create Procedure Temp_SupplyAndDemandInfo_Count
    @CountAll int OUTPUT,
    @TodayCount int OUTPUT
    ASbegin
    select @CountAll=count(*) from SupplyAndDemandInfo
    select @TodayCount=count(*) from SupplyAndDemandInfo
    where convert(char(8),getdate(),112)=[datetime]
    end