SQL中时间的加减法
SQL中时间的加减法[@more@]-declare @temp datetimeset @temp = getdate();select @tempselect dateadd(m,-9, @temp)参数 m的可以被下面的值代替: yyyy 年 q 季 m 月 y 一年的日数 d 日 w 一周的日数 ww 周 h 时 n 分钟 s 秒
SQL Server 中创建返回值为表的函数其中包括游标的使用方法
SQL Server 中创建返回值为表的函数其中包括游标的使用方法[@more@]CREATE FUNCTION GetOneLayGroupChild_li(@paraParentId as smalldatetime) --输入参数 returns @tChildGroup table(cGroupId int, pGroupId int) --返回参数 AS begindeclare @tParentId int,@tChildId int --第一步.声明一个名为Order_Cursor的游标.游标为一个行集。所以下面为一个select语句 declare Order_Cursor cursor for select pkid,parentid from [group] --第二步.打开游标,检索数据并填充游标 open Order_Cursor --第三步.fetch会使游标移到下一条记录,并