Solved

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

Posted on 2012-03-14
7
216 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 33

Expert Comment

by:paulmacd
Comment Utility
Do the insert without specifying the Dbf_l_Id column/value.
0
 
LVL 11

Expert Comment

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

Author Comment

by:iscivanomar
Comment Utility
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Accepted Solution

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

Expert Comment

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

Expert Comment

by:Anthony Perkins
Comment Utility
>>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
Comment Utility
I look into the table design and identity is set to No.
Thank you
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

SQL Server engine let you use a Windows account or a SQL Server account to connect to a SQL Server instance. This can be configured immediatly during the SQL Server installation or after in the Server Authentication section in the Server properties …
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.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

762 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now