SQL 获取当前日期,年、月、日、周、时、分、秒
select GETDATE() as '当前日期',
DateName(year,GetDate()) as '年',
DateName(month,GetDate()) as '月',
DateName(day,GetDate()) as '日',
DateName(dw,GetDate()) as '星期',
DateName(week,GetDate()) as '周数',
DateName(hour,GetDate()) as '时',
DateName(minute,GetDate()) as '分',
DateName(second,GetDate()) as '秒'
结果:
2009-12-19 15:23:50.530 2009 12 19 星期六 51 15 23 50
相关文档:
新建表:
create table [表名]
(
[自动编号字段] int IDENTITY (1,1) PRIMARY KEY ,
[字段1] nVarChar(50) default '默认值' null ,
[字段2] ntext null ,
[字段3] datetime,
[字段4] money null ,
[字段5] int default 0,
[字段6] Decimal (12,4) default 0,
[字段7] image null ,
)
删除表:
Drop table [表 ......
--当前使用的数据库是 系统自带的 master
create database temp1
go --此处不加go的话下面use temp1 会报错:找不到存储过程 'temp1'。
use temp1
set xact_abort on
begin tran
create table [order]( --order是关键字必须用[ ];
id int
)
create table fOrder(
id int
)
-- 下面的操作主要是为了实现fO ......
系统要求进行SQL优化,对效率比较低的SQL进行优化,使其运行效率更高,其中要求对SQL中的部分in/not in修改为exists/not exists
修改方法如下:
in的SQL语句
SELECT id, category_id, htmlfile, title, convert(varchar(20),begintime,112) as pubtime
from tab_oa_pub WHERE is_check=1 and
category_id in (sel ......
党员管理系统的数据库设计
需要以下字段:
l 学生:
//学生基本信息
u 学生学号[id](char)主键
u 学生身份证号[id_num](char)
u 学生姓名[name](char)
u 学生出生日期[born_date](date)
u 学生籍贯[native](int)外键
u 学生家庭住址[address](char)
u&nbs ......
SQL客户端是每个开发人员所需的必不可少的工具。他们帮助开发人员轻松地在任何数据库执行SQL查询。它们对于解决任何数据库相关的问题也是非常重要的。
1. SQuirreL SQL Client
SQuirreL SQL Client是目前最流行的开源SQL客户端。 ......