Solved

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

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

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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
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…

729 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