July 28, 2006 at 4:37 am
i want primary key of table to be inserted automatically. i've set its in desgin table as Identity = Yes; Seed=1
i want my application all other attributes except primary key which i've set atutomatically inserted.
but by doing this; it doesn't insert its value. instead it enters 0
can u plz help me in doing so?
July 28, 2006 at 4:53 am
can you post your DDL ?
Johan
Learn to play, play to learn !
Dont drive faster than your guardian angel can fly ...
but keeping both feet on the ground wont get you anywhere :w00t:
- How to post Performance Problems
- How to post data/code to get the best help[/url]
- How to prevent a sore throat after hours of presenting ppt
press F1 for solution, press shift+F1 for urgent solution 😀
Need a bit of Powershell? How about this
Who am I ? Sometimes this is me but most of the time this is me
July 28, 2006 at 5:11 am
CREATE TABLE [BillPayment] (
[billpaymentId] [int] IDENTITY (1, 1) NOT NULL ,
[billPaymentDate] [datetime] NULL ,
[newBillBalance] [float] NULL ,
[billAmount] [float] NULL ,
CONSTRAINT [PK_BillPayment] PRIMARY KEY CLUSTERED
(
[billpaymentId]
  ON [PRIMARY]
) ON [PRIMARY]
GO
July 28, 2006 at 5:26 am
Works fine overhere ...
CREATE TABLE [BillPayment] (
[billpaymentId] [int] IDENTITY (1, 1) NOT NULL ,
[billPaymentDate] [datetime] NULL ,
[newBillBalance] [float] NULL ,
[billAmount] [float] NULL ,
CONSTRAINT [PK_BillPayment] PRIMARY KEY CLUSTERED
(
[billpaymentId]
  ON [PRIMARY]
) ON [PRIMARY]
GO
insert into BillPayment default values
go
insert into BillPayment default values
go
select * from BillPayment
go
-- billpaymentId billPaymentDate newBillBalance billAmount
-- ------------- ------------------------------------------------------ ----------------------------------------------------- -----------------------------------------------------
-- 1 NULL NULL NULL
-- 2 NULL NULL NULL
--
-- (2 row(s) affected)
--
Johan
Learn to play, play to learn !
Dont drive faster than your guardian angel can fly ...
but keeping both feet on the ground wont get you anywhere :w00t:
- How to post Performance Problems
- How to post data/code to get the best help[/url]
- How to prevent a sore throat after hours of presenting ppt
press F1 for solution, press shift+F1 for urgent solution 😀
Need a bit of Powershell? How about this
Who am I ? Sometimes this is me but most of the time this is me
July 31, 2006 at 9:26 am
Can you post your insert statement as well?
You should also make sure SET IDENTITY INSERT isn't set to ON
Gianni Cache
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply