SQL Server: creating table variable, error in primary key constraint definition

后端 未结 4 1018
遇见更好的自我
遇见更好的自我 2021-01-27 14:47

I\'m trying to create a table variable with primary key. What is the difference between these two statements? Why the first one does not work?

--This does not wo         


        
4条回答
  •  故里飘歌
    2021-01-27 14:50

    There are differences in the syntax between the CREATE TABLE (Transact-SQL) and DECLARE @local_variable (Transact-SQL) used in creating table variables. You can not use the syntax of the first statement to create a variable table.

提交回复
热议问题