The SQL Server Stored Procedure encountered the error "Table'' # TT ''cannot perform the SET operation without the identity attribute,
An error is reported when a temporary table is created and data is inserted into the temporary table.
The system prompts that the primary key is not opened at the beginning. When the primary key is opened, the system prompts that the above error is abnormal.
I couldn't find the information on the Internet, and then asked you about the information in the group. A Daniel told me that I didn't set the primary key.
I took a closer look at the prompt and suddenly realized that I set a primary key for the temporary.
Code before the primary key is absent:
Create table # TT (CourseId INT, UserId INT, ClassId INT) INSERTINTO # TT (CourseId, UserId, ClassId) SELECT CourseId, UserId, ClassIdFROM dbo. T_MyOrder
If executed, the "table '# tt' is not identified. Failed to perform the SET operation "error
Code after modification:
Create table # TT (CourseId int primary key, UserId INT, ClassId INT) INSERTINTO # TT (CourseId, UserId, ClassId) SELECT CourseId, UserId, ClassIdFROM dbo. T_MyOrder
No error is reported.
Then I removed the keyword 'Primary key', and SQL server does not report an error. I don't know what's going on now!
The above is a small series of SQL Server Stored Procedures encountered the "table" # TT "no identity attribute can not perform the SET operation" error, I hope to help you, if you have any questions, please leave a message and the editor will reply to you in time. Thank you very much for your support for the help House website!