Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
rajeshkumar77
Starting Member
46 Posts |
Posted - 2001-12-16 : 02:43:19
|
| haihow to create a table in database thru query analyzer.i have a default value for the field.for ex.create table emp (eno int);for the above table how can i set the default value for eno field.can anybody know this..please give me the sql query to create table with default valuesThanks in advanceYoursRajesh |
|
|
VyasKN
SQL Server MVP & SQLTeam MVY
313 Posts |
Posted - 2001-12-16 : 04:31:01
|
| Rajesh, try this:CREATE TABLE Emp (eno int DEFAULT 1)GOThe above command sets a default value of 1 to eno column.Instead you could try this, so that everytime you insert a row into Emp table, you get a new value for eno column.CREATE TABLE Emp (eno int IDENTITY)GOFor more information see BOL.Vyas[url]http://vyaskn.tripod.com[/url] |
 |
|
|
|
|
|