Wednesday, March 28, 2012

how to insert int variable...

hi,

I have two question

string a;

int i;

insert into sss (id, name) values(.....)

as id is integer and name is nvarchar in the database.

how can I write this variable within the values paranthesis

2) how to adjust a column in sql server 2005 to auto number

thanks

I may be mistaken, but these seem to me to be questions which are not specific to the ADO.Net vNext technology preview--but rather general SQL server questions. Given that assumption, I'm moving this thread to a more appropriate forum. If I'm mistaken and this does more directly apply to the ADO.Net technology preview, please post again back in that forum.|||Do you want to know how to exactly insert them in .NET or TSQL ? TheI Insert should be straight forward using something like

insert into sss (id, name) values(i,a)

You can′t cahnge the id column to a autonumber (in SQL Server it is called identity column), you will have to add a column and assign the identity value while the creation to it. Thats actually what the designer like SSMS does behind the scenes, creating a new table with the ID column, copying all the data from one to the other table, renaming the new one and dropping the old.
You don′t have to care about that if you are using the GUI, its just to keep in mind as the process will take a while.

HTH, jens Suessmeyer.

http://www.sqlserver2005.de

No comments:

Post a Comment