易截截图软件、单文件、免安装、纯绿色、仅160KB

SQL日历表数据的简单生成

为了公司考勤系统的需要
编写的几个简单存储过程(可以手动运行,也可以设置事务自动运行!感觉还行比较通用,写出来共享下)
Calendar表结构很简单,2个字段:
fdDate 日期
fdType 考勤类型(工作日N,周末W,节假日H[需要根据需要自己修改])
--判断一段时间范围内的工作日(N)和周末(W)
Create     PROCEDURE [dbo].[NewMonthWeekDay_Calendar]
@sdate smalldatetime,
@edate smalldatetime
AS
declare @fdDate smalldatetime
declare @WeekDay varchar(20)
declare cr0 cursor for
 select fdDate from calendar where fddate>=@sdate and fddate<=@edate
open cr0
fetch next from cr0 into @fdDate
 while @@fetch_status=0
 begin
  if (datename(weekday,@fdDate)='星期一')
   update calendar set fdType='N' where fdDate=@fdDate
  if (datename(weekday,@fdDate)='星期二')
   update calendar set fdType='N' where fdDate=@fdDate
  if (datename(weekday,@fdDate)='星期三')
   update calendar set fdType='N' where fdDate=@fdDate
  if (datename(weekday,@fdDate)='星期四')
   update calendar set fdType='N' where fdDate=@fdDate
  if (datename(weekday,@fdDate)='星期五')
   update calendar set fdType='N' where fdDate=@fdDate
  if (datename(weekday,@fdDate)='星期六')
   update calendar set fdType='W' where fdDate=@fdDate
  if (datename(weekday,@fdDate)='星期日')
   update calendar set fdType='W' where fdDate=@fdDate
  
  fetch next from cr0 into @fdDate
 end
close cr0
deallocate cr0 
--根据年和月自动插入Calendar表新日期数据
Create    PROCEDURE [dbo].[NewMonth_Calendar]
@Year int,
@Month int
AS
 Select TOP 50 ID = Identity(Int, 0, 1) Into #T from SysColumns
 insert into cas..calendar(fdDate)
 Select Convert(Varchar(10), DateAdd(dd, ID, Cast(Rtrim(@Year) + '-' + Rtrim(@Month) + '-' + '01' As DateTime)), 120) from #T
 W


相关文档:

航空公司管理系统(VC++ 与SQL 2005)

系统环境:Windows 7
软件环境:Visual C++ 2008 SP1 +SQL Server 2005
本次目的:编写一个航空管理系统
      这是数据库课程设计的成果,虽然成绩不佳,但是作为我用VC++ 以来编写的最大程序还是传到网上,以供参考。用VC++ 做数据库设计并不容易,但也不是不可能。以下是我的程序界面,后面 ......

SQL存储过程 概述

1.sql存储过程概述
2.SQL存储过程创建
3.sql存储过程及应用
4.各种存储过程使用指南
5.ASP中存储过程调用的两种方式及比较
6.SQL存储过程在.NET数据库中的应用
7.使用SQL存储过程要特别注意的问题
1.sql存储过程概述
在大型数据库系统中,存储过程和触发器具有很重要的作用。无论是存储过程还是触发器,都是SQL 语 ......

SQL操作全集

下列语句部分是Mssql语句,不可以在access中使用。
SQL分类:
DDL—数据定义语言(CREATE,ALTER,DROP,DECLARE)
DML—数据操纵语言(SELECT,DELETE,UPDATE,INSERT)
DCL—数据控制语言(GRANT,REVOKE,COMMIT,ROLLBACK)
首先,简要介绍基础语句:
1、说明:创建数据库
CREATE DATABASE data ......

Sql版本除去html并截取指定长度的字符串

set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
Go
----截取字符串,并出去html
create FUNCTION [dbo].[CutString] (@str varchar(1000),@length int) 
RETURNS varchar(1000) AS 
BEGIN
 declare @mainstr varchar(1000)
 declare @substr varchar(1000)
 if(@str is not null or @st ......

[SQL Server]关于对时间戳timestamp理解

一直对时间戳的概念模糊,并且网上也有很多朋友也都误认为:是一个时间字段,每次增加数据时,填入当前的时间值。导致也误导了很多朋友。
 
这次看了很多资料,纠正一下这个错误,自己也搞清楚:数据库中自动生成的唯一二进制数字,与时间和日期无关的, 通常用作给表行加版本戳的机制。存储大小为 8 个字节。
&nbs ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号