Connecting Tech Pros Worldwide Help | Site Map

Autogenerating values in a column while entering data.

chiragvithlani's Avatar
Newbie
 
Join Date: Oct 2007
Posts: 9
#1: Oct 22 '07
Hi, I am very much new to any forumns... sorry for the inconvinience if any !

Problem:- I need to autogenerate a column values while inserting data from one table to Master Table in SQL Server 2005, How can i do this in SQL ?

Details...

1. A detail table Company Table contains multiple coulumn with AreaCode
2. I am creating master table AreaCodeMst and have 2 fields..AreaCodeId and AreaCode
3. Now AreaCodeId is just SrNo 1,2,3..... n no of rows and its a primary key,
4. while writing the query...

insert into AreaCodeMst select distinct AreaCode from AreaCodeTable,

i want the AreadCodeId to be auto generated.....................in the master table

is this possible... how

Plz help..

Thanks..Waiting
.
Reply