原来在mysql中可以用substring来取数据库中时间的前几位,但是到sql2000就不行了,我想问在2000中怎么取时间的前几位,就是下面的语句在mysql中就能实行,但在2000中就不行了,怎么解决???RegDatetime是datetime类型的
String strSql1 = "select count(*) as A from cpd where substring(RegDatetime,1,7)<='2005-08' and CurState='1'";
String strSql1 = "select count(*) as A from cpd where substring(RegDatetime,1,7)<='2005-08' and CurState='1'";
Returns an integer representing the specified datepart of the specified date.Syntax
DATEPART ( datepart , date ) Arguments
datepartIs the parameter that specifies the part of the date to return. The table lists dateparts and abbreviations recognized by Microsoft® SQL Server™.Datepart Abbreviations
year yy, yyyy
quarter qq, q
month mm, m
dayofyear dy, y
day dd, d
week wk, ww
weekday dw
hour hh
minute mi, n
second ss, s
millisecond ms