Solved

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

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Database Containment - Benefits 6 26
Resize text 4 16
putting an icon in a form 13 21
DSum between dates 5 0
PL/SQL can be a very powerful tool for working directly with database tables. Being able to loop will allow you to perform more complex operations, but can be a little tricky to write correctly. This article will provide examples of basic loops alon…
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
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…

760 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

20 Experts available now in Live!

Get 1:1 Help Now