I have a stored procedure like this
create procedure onedata
as
begin
declare @input_data table (Id int NOT NULL AUTO_INCREMENT, name varchar(500) . .... )
insert into @input_data .....
....
end
But i am not able to declare Id to be AUTO_INCREMENT.It showing some error.
Please suggest some solution.
Thanks in advance
This depends on the variety of SQL you are using.
For SQL Server
declare @input_data table (Id int NOT NULL identity(1,1), name varchar(50))
From your syntax, I'm guessing you are using SQL Server. If so, use identity
instead of auto_increment
:
declare @input_data table (Id int primary key identity, ... )
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With