sql 求周數
sql中有沒有求周數的函數。
如oracle中:select to_char(to_date('20091001','yyyymmdd'),'ww') from dual
以年第一天所在周為第一周。
DATEPART
SQL code:
select datepart(wk,getdate())
/*-----------
52
(1 行受影响)*/
SQL code:
select datepart(wk,getdate())
SQL code:
select datepart(week , getdate())
select datename(week , getdate())
/*
-----------
52
(所影响的行数为 1 行)
------------------------------
52
(所影响的行数为 1 行)
*/
SQL code:
1> select DATEPART(week,getdate()),getdate();
2> go
|
-----------|-----------------------
52|2009-12-21 15:18:15.887
(1
相关问答:
我要做一个定点事件,是每天晚上12点就把三个表里的信息放入一个表里,我想用存储过程来写,怎么写呢?,那位高手帮帮忙吧,非常感谢!
用户名是唯一的
表A 字段
用户名:Name ,邮箱:Ema ......
--drop table #T1
--drop table #T2
create Table #T1(ID int,
QueryID nvarchar(20),
ResultID1 nvarchar(20),
ResultID2 nvarchar(20))
create Table #T2(SortNo int,
QueryID nvarchar(20),
ResultID1 nv ......
今天做了一个存储过程 环境是SQL2000数据库
大致如下
建立临时表
定义员工游标
循环员工(属于1个公司)
......
从数据库中查询一张表的数据
select 部门,姓名 from tb
如何才能生成下面的xml格式
XML code:
<folder state="unchecked" label="全部">
<folder state="unchecked&qu ......