怪物猎人物语碎岩:ASP编程把Accsee数据库转换成SQLServer遇到的问题

来源:百度文库 编辑:中科新闻网 时间:2024/04/27 16:49:19
原Accsee的语句
sql="select * from article where title='" &title&"' and Fpath=date()"
是把2006-8插入到Fpath字段中。
转换成SQLServer后出现错误:'date' 不是可以识别的 函数名。
网上说是因为日期函数不相同,在对ACCESS数据库处理中,可用date()、time()等函数,但对 SQLSERVER数据库处理中,只能用datediff,dateadd等函数,而不能用date()、time()等函数。

请问应该如何改写语句使2006-8插入到Fpath字段中,并且用sql="select * from article where title='" &title&"' and Fpath=date()"查询出来?

dim fpath
fpath="..\"&cstr(year(now()) &"-" & month(now()))
fname=makefilename(now())
Set fso = Server.CreateObject("Scripting.FileSystemObject")
Set fout = fso.Createtextfile(server.mappath(fpath&"\"&fname),true)
fout.writeline okfile
fout.close
Accsee中是这么用的
rs("fpath")=cstr(year(now()) &"-" & month(now()))
SQLServer中能不能这么用?
rs("fpath")=cstr(year(getdate()) &"-" & month(getdate()))

Access数据库和SQL语法的区别
http://www.fjcmw.net/mycode/show/view.asp?aid=22