byethost12.com
域名年龄: 19年3个月2天HTTP/1.1 200 OK 类型:text/html 修改日期:2014年11月05日 04:17:11 接受单位:字节 网页标记:"ede7d3506cf8cf1:0" 服务器:Microsoft-IIS/7.5 访问时间:2014年12月29日 19:29:20 文件大小:1258 页面编码:utf-8
保罗的蛋壳 Paul…….. SQLServer获取给定日期内的工作日 2011年03月28日 今天没事干,就想起以前在Oracle中用过别人写的一个存储过程,是用来将给定时间内的工作日返回出来,自己懒的去找,就想着在SQLServer中自己也写一个。 首先建了一张表用来存储查询出来的数据,当然也可以在Proc中创建一个临时表 create table WorkDayTemp ( WorkDayID int primary key identity(1,1), WorkDayType int, WorkDayDate datetime ) 然后是Proc主体, create procedure GetWorkDayIntoWorkDatTemp @BeginDate Datetime, @EndDate Datetime as declare @WorkDayType int begin while(@BeginDate<@EndDate) begin set @WorkDayType=(select DATEPART(dw,@beginDate)) if(@WorkDayType between 2 and 6) insert into WorkDayTemp values (@WorkDayType,@BeginDate) set @BeginDate+=1 end select WorkDayID, (case workdaytype when 2 then ‘Monday’ when 3 then ‘Tuesday’ when 4 then ‘Wednesday’ when 5 then ‘Thursday’ when 6 then ‘Friday’ else null end) as daytype, WorkDayDate from WorkDayTemp end 最后调用一下 exec getworkdayintoworkdattemp @beginDate=’2011-01-03′, @enddate=’2011-03-31′ 发布在 未分类 | 没有评论 » 小记。。。 2011年03月24日 Day after day,一日又一日的这样过去了,最近感觉自己很颓废,不知道为什么会这样子。下周就要回去了,本周基本上啥也没干。 今天,以前公司的同事邀我回以前公司的西安办事处工作,我谢绝了。没啥意义,可能跟自己的未来发展方向不太一致,所以没打算要回去。 最近一直不知道自己想干啥,又过上了每天晕晕沉沉的日子。想干啥自己也不知道,总想什么都学,却总是什么也学不好。自己已经迷茫了。。。。 发布在 未分类 | 没有评论 » 存储过程 2011年03月22日 今天修改了一下以前写过的一个存储过程,是用来向某条表中添加N条数据的,其中有个CategoryID的字段,是PrimaryKey,还有就是CategoryName和Description是varchar型的,我需要去插入一些描述信息以及一个CategoryType这样的一个东西,用来指定插入的具体是哪种类型的category /********************************** 向数据库中插入N条数据 **********************************/ –首先判断数据库中是否存在这样的procedure。如果存在,则删除之前的Procedure if exists(select * from sys.objects where object_id=object_id(N’CreateCustomerCategory’)) drop proc CreateCustomerCategory go –created new procedure create procedure CreateCustomerCategory @rowCount int, —定义一个输入参数,用来指定插入多少条数据 @CategoryType int —输入插入的类型 as declare @num int=0, –定义一个内部变量,用来循环插入
© 2010 - 2020 网站综合信息查询 同IP网站查询 相关类似网站查询 网站备案查询网站地图 最新查询 最近更新 优秀网站 热门网站 全部网站 同IP查询 备案查询
2025-06-27 05:36, Process in 0.0093 second.