Solved

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

Posted on 2013-05-22
3
544 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
  • 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

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.
As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

813 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

19 Experts available now in Live!

Get 1:1 Help Now