Wrox Programmer Forums
Go Back   Wrox Programmer Forums > SQL Server > SQL Server 2000 > SQL Server 2000
|
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 16th, 2004, 04:02 PM
Registered User
 
Join Date: Sep 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Update statement with EXISTS condition using 2 TBL

Hi

I need to update the field IBGLPT in table F4102 from the F4101 field IMGLPT for only the records where F4101 IMITM = F4102 IBITM

This is the statement that I put together:

UPDATE TESTDTA.F4102
SET TESTDTA.F4102.IBGLPT= ( SELECT TESTDTA.F4101.IMITM
                FROM TESTDTA.F4101
                WHERE TESTDTA.F4101.IMITM=TESTDTA.F4102.IBITM)
WHERE EXISTS
        (SELECT TESTDTA.F4101
    FROM F4101
    WHERE TESTDTA.F4101.IMITM=TESTDTA.F4102.IBITM);

I get an error; Arithmetic overflow error for type varchar, value = 721220.000000.

Any help is greatly appreciated

Thank you


 
Old September 16th, 2004, 09:58 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 625
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to jemacc
Default

Post your column data type for the tables. It may be that your are trying to insert varchar data into and intr column or the other way around.


 
Old September 17th, 2004, 01:49 AM
Registered User
 
Join Date: Sep 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

both colums, F4102 (IBGLPT) and F4101 (IMGLPT) are char, 4, NUll is flaged. Thanks

 
Old September 30th, 2004, 07:16 AM
Authorized User
 
Join Date: Sep 2004
Posts: 55
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to Lalit_Pratihari
Default

Hi,

You can very well see the length you have defined for the column and the value you are inserting.

You will have to increase the size of your column.

Thanks,

Lalit
Life Means More...;)





Similar Threads
Thread Thread Starter Forum Replies Last Post
update multiple columns in an update statement debbiecoates SQL Server 2000 1 August 17th, 2008 04:01 AM
UPDATE statement takwirira ASP.NET 2.0 Basics 7 March 7th, 2007 07:48 PM
Use a frm based on a qry to update a tbl Brucifier Access 1 August 8th, 2006 10:06 PM
UPDATE trigger won't fire on CASE-only condition _Katka_ SQL Server 2000 1 November 14th, 2003 11:59 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.