Solved

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

Posted on 2012-03-14
7
220 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
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Introduction: When running hybrid database environments, you often need to query some data from a remote db of any type, while being connected to your MS SQL Server database. Problems start when you try to combine that with some "user input" pass…
If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

730 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