What are the challenges you face when working across database platforms? Take the survey
Options

Insert Into @table with Identity Column

JimFJimF Posts: 49 Bronze 3
edited December 9, 2015 9:34AM in SQL Prompt
Hello,

SQL Prompt (at least 7.1.0.44) does not recognize an Identity column in a declared table when using "Insert Into".
Declare @WorkContestNew table
    (
      Id int Identity
             Primary Key,
      NewContestId int Not Null
    )

-- Insert Into gives me this...
Insert  Into @WorkContestNew
        ( Id, NewContestId )
Values  ( 0, -- Id - int
          0  -- NewContestId - int
          )

-- When I expect this...
Insert  Into @WorkContestNew
        ( NewContestId )
Values  ( 0  -- NewContestId - int
          )

Comments

Sign In or Register to comment.