我正在尝试使用经典ASP在SQL Server 2000中插入时间戳。除了时间戳之外,其余字符串都有效。我正在使用此查询获得空白插入。
sActionSQL = "Insert Into [mydatabase].dbo.AppUsers"
sActionSQL = sActionSQL & " ([UserID], [AuthorityLevel], [Stores], [Area],
[Password], [DateAdded])"
sActionSQL = sActionSQL & " Values ('" & UCase(Request.Form("UserID")) & "'"
sActionSQL = sActionSQL & " , " & Request.Form("AuthorityLevel")
sActionSQL = sActionSQL & " , '" & Request.Form("Stores") & "'"
sActionSQL = sActionSQL & " , '" & Request.Form("cboAreaDirector") & "'"
sActionSQL = sActionSQL & " , '" & sUserPassword & "'"
sActionSQL = sActionSQL & " , '" & (CURRENT_TIMESTAMP) & "')
DateAdded
列是varchar(50)
。我应该使用CURRENT_TIMESTAMP
还是DATEADD
?
答案 0 :(得分:0)
CURRENT_TIMESTAMP
,而DateAdd
就是它在锡上的内容:添加日期。为什么不使用Now
或Date
? (Now
是当前系统日期和时间,Date
是当前日期,没有时间部分。)