I need to create a set of data for our app. I am trying to get the iInserted ID to be printed in the messages panel, but nothing seems to work.
INSERT INTO ...
DECLARE @ID INTEGER = (SELECT @@Identity);
PRINT @ID;
The print is printing nothing at all...
How can I get the id
.?
I tried with
DECLARE @ID INTEGER = (SELECT IDENT_CURRENT('tablename'))
and it didn't work either...
EDIT: I need to PRINT the ID in the message PANEL, I must not print a table.
Script:
INSERT INTO Employee (Name, Email)
VALUES ('a', 'a')
DECLARE @id INTEGER = ??