?
Solved

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

Posted on 2012-03-14
7
Medium Priority
?
233 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
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

In this article I will describe the Backup & Restore 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.
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?

809 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