日期:2014-05-16 浏览次数:20442 次
要 点:
1,不可以对物理表进行修改、删除操作
2,不可以对数据库进行修改、删除操作
3,数据的暂时存储使用临时表
4,必须有一个要返回的查询语句
5,关键字只能做为查询条件
下述示例只做为参考使用
示例一:本期未记账单据
declare @StartTime datetime,
@EndTime datetime,
@CurYear smallint,
@CurPeriod smallint
SELECT @CurPeriod =CONVERT(smallint,FValue) FROM t_SystemProFile
WHERE FCategory='IC' AND FKey='CurrentPeriod'
SELECT @CurYear =CONVERT(smallint,FValue) FROM t_SystemProFile
WHERE FCategory='IC' AND FKey='CurrentYear'
EXEC GetPeriodStartEnd @CurYear,@CurPeriod ,@StartTime output,@EndTime output
SELECT t1.FInterID,
t1.FDate AS '日期',
t1.FBillNO as '单据号码',
t3.FShortNumber as '物料编码',
t3.FName as '物料名称',
t4.FName as '单位',
t2.FQty as '数量',
t2.FPrice as '单价',
t2.FAmount as '金额'
FROM ICStockBill t1,ICStockBillEntry t2,t_ICItem t3,t_MeasureUnit t4
WHERE t1.FInterID=t2.FInterID
AND t2.FItemID=t3.FItemID
AND t3.FUnitGroupID=t4.FUnitGroupID
AND t4.FStandard=1
AND t1.FPosted=0
AND t1.FDate>=@StartTime
AND&nb