开发者

VSTS 2008 Database Edition doesn't seem to know 'DATEADD' constants, any ideas?

I'm trying to implement a database build using VSTS 2008 Database Edition. The build always fails on the following constraint:

ALTER TABLE [dbo].[tablename]
    ADD CONSTRAINT [DF_tablename_date] DEFAULT (CONVERT([varchar],dateadd(hour,(-1),getdate()),(1))) FOR [date];

The error that it shows is the following:

TSD03082: The name "hour" is not permitted in this context. Valid expressions are constants, constant expressions, and (in some contexts) variables. Column names are not permitted.
开发者_开发知识库

Anybody have an idea what is wrong here?


Have you tried wrapping hour in square brackets, [hour] ?


Asked the same question on MSDN: http://social.msdn.microsoft.com/Forums/en-US/vstsdb/thread/24afdc7e-3cef-4322-99ff-76ac5174cf3c/

Looks like it's a bug. A workaround has been suggested in the thread.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜