?
Solved

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

Posted on 2012-03-14
7
Medium Priority
?
224 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
[X]
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
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
Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

 

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

Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

Question has a verified solution.

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

INTRODUCTION: While tying your database objects into builds and your enterprise source control system takes a third-party product (like Visual Studio Database Edition or Red-Gate's SQL Source Control), you can achieve some protection using a sing…
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 this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

770 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