How should I declare auto increment variable in the virtual table of stored procedure

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

Answers


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, ... )

Need Your Help

Jquery Issue - Drop down list does NOT show from iPhone/Mobile Devices

iphone jquery drop-down-menu

When I see my website http://www.jazzheaven.com from my iPhone: the 2 DROP-DOWNS do NOT work from the iPhone.

Reading SIP invite packets before reaching softphone

c# wpf sockets udp sip

I'm trying to create an wpf-app that read/sniff the SIP-invite (UDP) for every incoming call to my softphone. Problem is that I can't connect to the same port. I tried to run it in administrator mo...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.