| Author |
Topic |
|
shruthi_R
Starting Member
10 Posts |
Posted - 2007-03-26 : 02:04:03
|
| i have a table for storing username and password.the following are the fields in tableID -intUserName-nvarchar(50)Password-nvarchar(50)i dont want to have a separate field for idi want to autincrement themplz give me an ideaam using SQLServer Expressam new to this field so plz forgive me for this simple questionthanks Shruthi |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2007-03-26 : 02:07:12
|
| You can't change an existing column to autoincrement. Your only way is to do it through EM.Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-03-26 : 02:07:29
|
create the ID as identitycreate table table_name( ID int identity, UserName nvarchar(50), . . . ) KH |
 |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2007-03-27 : 01:28:58
|
| "Excuse me?"Why?Do you think otherwise? Is there any other way except to create a new table with identity column and copying existing table contents into it? If yes, please enlighten me.Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
|
X002548
Not Just a Number
15586 Posts |
Posted - 2007-03-27 : 09:30:05
|
quote: Originally posted by harsh_athalye "Excuse me?"Why?Do you think otherwise? Is there any other way except to create a new table with identity column and copying existing table contents into it? If yes, please enlighten me.Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED"
??????EM is the only way?DDL & DML in osql for one?Brett8-)Hint: Want your questions answered fast? Follow the direction in this linkhttp://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspxAdd yourself!http://www.frappr.com/sqlteam |
 |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2007-03-27 : 09:40:35
|
| Yes, that is true. You can always create a new table with identity, copy all existing contents and once done, drop original table and rename new table with original table name.But that's what EM do behind the scenes, right?Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2007-03-27 : 09:49:11
|
| Same with me...I suggested using EM only looking at the SQL skills of the poster...I am not a great fan of EM, either.Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
|
|