请各位SQL高手推荐几本SQLServer方面的书?
9 个解决方案
#1
if '2000-1-1'<getdate()
select '大'
..
select '大'
..
#2
select datediff(day,'2001-1-1','2002-1-1') 天
select datediff(month'2001-1-1','2002-1-1') 月
select datediff(year,'2001-1-1','2002-1-1') 年
select datediff(month'2001-1-1','2002-1-1') 月
select datediff(year,'2001-1-1','2002-1-1') 年
#3
直接比较就行了。
where '2003-10-23'>'2002-10-20'
where '2003-10-23'>'2002-10-20'
#4
where 日期字段>'2002-10-20'
#5
联机丛书 + CSDN
#6
如何把一个俱体的日期赋给一个变量,如:
declare fdate datetime
set fdate = '2000-01-01'
可吗?
declare fdate datetime
set fdate = '2000-01-01'
可吗?
#7
日期可以直接比较.赋值当然更没问题.
declare @fdate datetime
set @fdate = '2000-01-01'
select * from 表 where 日期字段<@fdate
declare @fdate datetime
set @fdate = '2000-01-01'
select * from 表 where 日期字段<@fdate
#8
这样做没问题,最好在赋值前用isdate()判断一下。
#9
CREATE PROCEDURE sp_prod
@pono varchar(12) = '0000',
@itemno varchar(20) = '0000',
@fdate datetime ,
@tdate datetime
as
fdate 和 tdate如何赋缺省值,直接写不行:
CREATE PROCEDURE sp_prod
@pono varchar(12) = '0000',
@itemno varchar(20) = '0000',
@fdate datetime = 2000-01-01,
@tdate datetime = getdate()
as
@pono varchar(12) = '0000',
@itemno varchar(20) = '0000',
@fdate datetime ,
@tdate datetime
as
fdate 和 tdate如何赋缺省值,直接写不行:
CREATE PROCEDURE sp_prod
@pono varchar(12) = '0000',
@itemno varchar(20) = '0000',
@fdate datetime = 2000-01-01,
@tdate datetime = getdate()
as
#1
if '2000-1-1'<getdate()
select '大'
..
select '大'
..
#2
select datediff(day,'2001-1-1','2002-1-1') 天
select datediff(month'2001-1-1','2002-1-1') 月
select datediff(year,'2001-1-1','2002-1-1') 年
select datediff(month'2001-1-1','2002-1-1') 月
select datediff(year,'2001-1-1','2002-1-1') 年
#3
直接比较就行了。
where '2003-10-23'>'2002-10-20'
where '2003-10-23'>'2002-10-20'
#4
where 日期字段>'2002-10-20'
#5
联机丛书 + CSDN
#6
如何把一个俱体的日期赋给一个变量,如:
declare fdate datetime
set fdate = '2000-01-01'
可吗?
declare fdate datetime
set fdate = '2000-01-01'
可吗?
#7
日期可以直接比较.赋值当然更没问题.
declare @fdate datetime
set @fdate = '2000-01-01'
select * from 表 where 日期字段<@fdate
declare @fdate datetime
set @fdate = '2000-01-01'
select * from 表 where 日期字段<@fdate
#8
这样做没问题,最好在赋值前用isdate()判断一下。
#9
CREATE PROCEDURE sp_prod
@pono varchar(12) = '0000',
@itemno varchar(20) = '0000',
@fdate datetime ,
@tdate datetime
as
fdate 和 tdate如何赋缺省值,直接写不行:
CREATE PROCEDURE sp_prod
@pono varchar(12) = '0000',
@itemno varchar(20) = '0000',
@fdate datetime = 2000-01-01,
@tdate datetime = getdate()
as
@pono varchar(12) = '0000',
@itemno varchar(20) = '0000',
@fdate datetime ,
@tdate datetime
as
fdate 和 tdate如何赋缺省值,直接写不行:
CREATE PROCEDURE sp_prod
@pono varchar(12) = '0000',
@itemno varchar(20) = '0000',
@fdate datetime = 2000-01-01,
@tdate datetime = getdate()
as