开发者

Execute Command and Now()

DataContext.ExecuteCommand("DELETE from Table WHERE Date < Now()");

I get an error about how Now() is not a recogn开发者_如何转开发ized built in function name.


When you send your SQL query directly to SQL Server, you need to use the SQL Server functions - not the .NET ones.

Use this instead:

DataContext.ExecuteCommand("DELETE from Table WHERE Date < GETDATE()");

GETDATE() is the T-SQL equivalent for Now()


Now() is not TSQL. Use GETDATE() or GETUTCDATE()


Could that be GetDate() instead of Now()?


You should use GETDATE() instead of NOW()


I don't think Now() is a recognized function in SQL.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜