选择新条目以确认电子邮件 [英] Select new entries for confirmation email

查看:160
本文介绍了选择新条目以确认电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



可能有一种更简单的方式来实现我想要做的事情。如果您知道,请提出建议。



我想从三张只有一分钟的表中选择新数据。然后使用C#,发送确认和提醒电子邮件。这是我的剧本。



Hi all,

There is probably an easier way of achieving what I am trying to do. Please suggest it if you do know.

I would like to select new data from three tables that are only a minute old. Then using C#, send confirmation and reminder email. Here is my script.

SELECT B.BookingID,
		S.StaffName,
		A.Asset,
		B.StartDate,
		B.EndDate,
		B.StartTime, 
		B.EndTime,
		A.Campus,
		B.Location,
		B.Arrengement,
		B.Messege
FROM tblBooking as B INNER JOIN tblAssets as A 
								 
		on B.AssetID = A.AssetID
		inner join tblStaff as S
		on B.StaffID = S.StaffID
where B.StartTime <= DATE_SUB(curdate() INTERVAL 5 MINUTE) 





执行上述操作时,我得到以下内容;





when executing the above, I get the following;

Msg 195, Level 15, State 10, Line 15
'curdate' is not a recognized built-in function name.





我尝试了大多数解决方案,我在网上找到了SSMS给了我不同的错误。如果你能提供帮助我很感激。



I tried most solution I found online with SSMS giving me different errors. I appreciate it if you're able help.

推荐答案

很明显......你使用的SQL版本没有一个名为<$ c $的函数C> CURDATE()。如果您使用的是SQL Server,请尝试使用 getdate()



您可能会在 DATE_SUB 上遇到类似的错误 - 尝试datediff [ ^ ]而不是。



这里的真实信息是不要在线复制解决方案,除非你确定他们是你需要的相同语言/框架/等。







It's quite clear ... whatever version of SQL you are using does not have a function called curdate(). If you are using SQL Server then try using getdate().

You will probably then get a similar error on DATE_SUB - try datediff[^] instead.

The real message here is don't copy solutions online unless you are sure they are for the same language/framework/etc that you need.



引用:

我试图用不同的函数解决它..并尝试研究。

for:

WHERE StartDate< = CONVERT(dateTime,DATEDIFF(分钟,5,GETDATE()))

我收到错误

Msg 8115,Level 16,State 2,Line 1

将表达式转换为数据类型datetime的算术溢出错误。

I have tried to resolve it using different function.. and tried researching.
for:
WHERE StartDate <= CONVERT(dateTime, DATEDIFF(minute, 5, GETDATE()))
I get error
Msg 8115, Level 16, State 2, Line 1
Arithmetic overflow error converting expression to data type datetime.

Datediff 函数返回整数 - 即。分钟数(或秒数,或年数等),不能转换为 DateTime 。使用StartDate和StartTime列以及函数中的当前日期时间,例如

The Datediff function returns an integer - ie. the number of minutes (or seconds, or years etc etc) and cannot be converted to a DateTime. Use your StartDate and StartTime columns and the current datetime within the function e.g.

where DATEDIFF(minute, GETDATE(), StartDate + CONVERT(DateTime, StartTime)) > 5


CURDATE 是一个mySql函数。您使用的是mySql吗?

如果您的SQL Server需要使用 Getdate()
CURDATE is a mySql function. Are you using mySql?
If its SQL Server you need to use Getdate().


这篇关于选择新条目以确认电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆