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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 insert

Author  Topic 

jogin malathi
Posting Yak Master

117 Posts

Posted - 2007-06-06 : 07:54:52
hi all
in database i want to insert
01
02
03
04
.
.
.
.
.

for f_area id
datatype is int
how this is possible

Thanks in advance


Malathi Rao

pbguy
Constraint Violating Yak Guru

319 Posts

Posted - 2007-06-06 : 08:01:57
Make that column as identity, so you no need to insert it will automatically inserted
f_area_id int identity(1,1)

--------------------------------------------------
S.Ahamed
Go to Top of Page

jogin malathi
Posting Yak Master

117 Posts

Posted - 2007-06-06 : 08:19:58
quote:
Originally posted by pbguy

Make that column as identity, so you no need to insert it will automatically inserted
f_area_id int identity(1,1)

--------------------------------------------------
S.Ahamed




no its not working
the same 1 is inserted
i created table as
create table temp1(id int ,f_f int identity(1,1))


Malathi Rao
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-06-06 : 08:24:20
What is not working ? Any error message ?

create table temp1(id int ,f_f int identity(1,1))

insert into temp1 ( id ) values ( 20 )
insert into temp1 ( id ) values ( 10 )

select * from temp1

id f_f
----------- -----------
20 1
10 2

(2 row(s) affected)




KH

Go to Top of Page

jogin malathi
Posting Yak Master

117 Posts

Posted - 2007-06-06 : 08:26:55
quote:
Originally posted by khtan

What is not working ? Any error message ?

create table temp1(id int ,f_f int identity(1,1))

insert into temp1 ( id ) values ( 20 )
insert into temp1 ( id ) values ( 10 )

select * from temp1

id f_f
----------- -----------
20 1
10 2

(2 row(s) affected)




KH




ya no error but
i requirement is
01
02 and soo on shoul insert into f_f field
not 1,2,3......

Malathi Rao
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-06-06 : 08:29:38
quote:
for f_area id
datatype is int


You said it is integer ?


KH

Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-06-06 : 08:31:15
This might be related and of your interest http://www.sqlteam.com/item.asp?ItemID=26939


KH

Go to Top of Page

jogin malathi
Posting Yak Master

117 Posts

Posted - 2007-06-06 : 08:31:34
quote:
Originally posted by khtan

quote:
for f_area id
datatype is int


You said it is integer ?


KH




ya but is their any chance


Malathi Rao
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-06-06 : 08:34:43
do the formatting in your front end when you retrieve the data.


KH

Go to Top of Page
   

- Advertisement -