Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

How can I add a record where the key is automatic?

Posted on 2012-03-14
7
219 Views
Last Modified: 2012-03-19
I want to insert this values in a table, Dbf_l_Id is automatic.

INSERT INTO [WMSSAVANNAH].[Storage].[Tbl_StoragePosition]
           ([Dbf_l_Id]           ,[Dbf_l_Version]           ,[Dbf_l_Id_StorageLocation]           ,[Dbf_l_Position]           ,[Dbf_l_Row]
           ,[Dbf_l_Level]           ,[Dbf_f_Width]           ,[Dbf_f_Length]           ,[Dbf_f_Height]           ,[Dbf_f_Clearance]           ,[Dbf_l_Capacity]
           ,[Dbf_b_RetrivalDisabled]           ,[Dbf_b_StorageDisabled]           ,[Dbf_b_RetrivalBlocked]           ,[Dbf_b_StorageBlocked]           ,[Dbf_l_X]
           ,[Dbf_l_Y]           ,[Dbf_f_Angle]           ,[Dbf_f_ClearanceBigFoot])
     VALUES
           (
           ,65--<Dbf_l_Version, int,>
           ,4982--<Dbf_l_Id_StorageLocation, bigint,>
           ,0--<Dbf_l_Position, int,>
           ,0--<Dbf_l_Row, int,>
           ,0--<Dbf_l_Level, int,>
           ,1220--<Dbf_f_Width, real,>
           ,1016--<Dbf_f_Length, real,>
           ,0--<Dbf_f_Height, real,>
           ,200--<Dbf_f_Clearance, real,>
           ,0--<Dbf_l_Capacity, int,>
           ,1--<Dbf_b_RetrivalDisabled, bit,>
           ,1--<Dbf_b_StorageDisabled, bit,>
           ,1--<Dbf_b_RetrivalBlocked, bit,>
           ,1--<Dbf_b_StorageBlocked, bit,>
           ,''--<Dbf_l_X, int,>
           ,''--<Dbf_l_Y, int,>
           ,''--<Dbf_f_Angle, real,>
           ,200--<Dbf_f_ClearanceBigFoot, real,>)
GO

Thank you
0
Comment
Question by:iscivanomar
7 Comments
 
LVL 34

Expert Comment

by:Paul MacDonald
ID: 37722285
Do the insert without specifying the Dbf_l_Id column/value.
0
 
LVL 11

Expert Comment

by:Simone B
ID: 37722299
What you have looks like it should work. The Dbf_l_Id should populate itself. Are you getting errors?
0
 

Author Comment

by:iscivanomar
ID: 37722326
this is the error that I am getting if I do not write the Dbf_l_Id

Cannot insert the value NULL into column 'Dbf_l_Id', table 'WMSSAVANNAH.Storage.Tbl_StoragePosition'; column does not allow nulls. INSERT fails.
The statement has been terminated.


the identity is not set to Yes. I think is should be but I do not want to break anything.
0
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 

Accepted Solution

by:
iscivanomar earned 0 total points
ID: 37722335
the problem is the Identity.  it is set to No.
0
 
LVL 11

Expert Comment

by:Simone B
ID: 37722342
Hmmm ... and what happens when you try to insert a value?
0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 37722574
>>I look into the table design and identity is set to No<<
Then you should be accepting the comment here http:#a37722335
0
 

Author Closing Comment

by:iscivanomar
ID: 37736823
I look into the table design and identity is set to No.
Thank you
0

Featured Post

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question