sql 区间时间判断
[code]declare @startdt datetime
declare @enddt datetime
select @startdt='2009-12-03',@enddt='2009-12-05'
select * from tb
where 开始日期 between @startdt and @enddt
or 结束日期 between @startdt and @enddt
or @startdt between 开始日期 and 结束日期
or @enddt between 开始日期 and 结束日期[/code]
相关文档:
-- 表的结构 area
DROP TABLE area;
CREATE TABLE area (
id int NOT NULL ,
areaID int NOT NULL,
area varchar(200) NOT NULL,
fatherID int NOT NULL,
PRIMARY KEY (id)
)
DROP TABLE city;
CREATE TABLE city select
id int NOT NULL ......
sql精妙用法
文章分类:数据库
说明:复制表(只复制结构,源表名:a 新表名:b)
select * into b from a where 1<>1
说明:拷贝表(拷贝数据,源表名:a 目标表名:b)
insert into b(a, b, c) select d,e,f from b;
说明:显示文章、提交人和最后回复时间
select a.title,a.username,b.adddate ......
--当两个或两以上的操作要么都执行,要么都不执行时要用事务。
1. Sql写法(事物+游标)
--开始事务
BEGIN TRAN
--不显示计数信息
SET NOCOUNT ON
DECLARE @ProjNo varchar(50),@CusNo varchar(50)
--声明游标
DECLARE CRMPSContact_cursor CURSOR FOR
SEL ......
使用VB把Excel导入到Sql数据库中,其实有几种方法。
下面我介绍的这种方法,较为简单。
其实这种方法的话,是直接使用T-SQL操作的,因此,到了VB里面,直接eccute这个代码就OK了的。
-----------------------------------------------------下面是在T-sql中的语句
if object_id('NewTable') is not null/*判断表NewTabl ......