开发者

Simple question on a SQL create table

I was actually in process of creating a sample table in my test database when somehow I missed out on proper syntax and came up with this statement for create table -

CREATE TABLE A (id as开发者_开发知识库 INT, column1 as nvarchar(10))

and when I tried to execute this statement, I got the error below -

'nvarchar' is not a recognized built-in function name.

Altough, I found that I should not have used "as" in the column declaration and corrected it, I am now curious on why I got this error for only nvarchar and not for INT. Also why this error instead of a incorrect syntax or something like that.

Thanks in advance.


AS is used to define computed columns. Therefore SQL Server expects an expression here, and this "looks" like a function call.

Computed columns info on MSDN for SQl Server 2005

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜