Solved

You tried to assign the null value to a variable that is not a variant data type.

Posted on 2013-05-22
3
551 Views
Last Modified: 2013-06-13
I am trying to change a value from “01                 ” to “                    “  using either MS Access 2003 or SQL Server Management Studio 2008.

The MS Access SQL:

UPDATE PRODDTA_F41021 SET PRODDTA_F41021.LILOCN = "                    " 
WHERE (((PRODDTA_F41021.LIITM)=989955) AND ((PRODDTA_F41021.LIPBIN)="P"));

The SQL Server 2008 Management Studio SQL:

UPDATE PRODDTA.F41021 SET PRODDTA.F41021.LILOCN = '                    ' WHERE (((PRODDTA.F41021.LIITM)=989955) AND ((PRODDTA.F41021.LIPBIN)='P'));

I get this error:

Msg 2627, Level 14, State 1, Line 1
Violation of PRIMARY KEY constraint 'F41021_PK'. Cannot insert duplicate key in object 'PRODDTA.F41021'. The duplicate key value is (989955,        24101,                     ,                               ).
The statement has been terminated.

I know it can be done because the field, LILOCN, already contains the ‘Blank Values’ of "                    " in many places.

Here is the design speck for the field:

      Field      Description      Type      Length      Decimals      DataItem
      LILOCN      Location      String      20      Location

Somehow, I gotta’ figure out how to do this. Any suggestions?

Tw
SQL-Error.xls
You-tried-to-assign-the-null-val.doc
0
Comment
Question by:Tom Winslow
[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
  • 2
3 Comments
 
LVL 65

Accepted Solution

by:
Jim Horn earned 500 total points
ID: 39187954
<wild guess>
Check your PRODDTA.F41021 table for any triggers, as if you run an UPDATE query it wouldn't be INSERTing rows unless there's an update trigger with code that performs an INSERT.
0
 

Author Comment

by:Tom Winslow
ID: 39188454
No triggers that I can find.

tw
0
 

Author Closing Comment

by:Tom Winslow
ID: 39245663
I used your suggestion to find my own solution.
0

Featured Post

Major Incident Management Communications

Major incidents and IT service outages cost companies millions. Often the solution to minimizing damage is automated communication. Find out more in our Major Incident Management Communications infographic.

Question has a verified solution.

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

Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

731 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