Update Command with bigint condintion [Resolved]

Posted by Guna27 under Sql Server on 12/15/2012 | Points: 10 | Views : 989 | Status : [Member] | Replies : 1
Hi, I have a Table(NewAccount) and columns AccountNo is bigint type and Amount is money data type

update NewAccount set Amount=5000 where AccountNo=1234561234561234


Error:
Msg 8115, Level 16, State 2, Procedure credittransaction, Line 10
Arithmetic overflow error converting expression to data type int.
The statement has been terminated.

This command works well: update NewAccount set Amount=5000 where AccountNo=999

Guna..............


Responses

Posted by: Sandeepmhatre on: 12/15/2012 [Member] Starter | Points: 50

Up
0
Down

Resolved
USE [Developement]
GO

/****** Object: Table [dbo].[my_TestTab] Script Date: 12/15/2012 13:14:15 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[my_TestTab](
[ID] [int] IDENTITY(1,1) NOT NULL,
[VAL] [datetime] NOT NULL,
[accountNo] [bigint] NULL,
[amount] [money] NULL,
PRIMARY KEY CLUSTERED
(
[ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO



INSERT INTO [Developement].[dbo].[my_TestTab]
([VAL]
,[accountNo]
,[amount])
VALUES
( getdate(), null , null)
GO



select * from my_Testtab


update my_Testtab set Amount=50010 , AccountNo=1234561234561234 where id =1

update my_Testtab set Amount=50020 where AccountNo=1234561234561234


I didnt get the error,
try this script .
if still error occurs the reply with ur script

Regards,
Sandeep Mhatre

Sandeep M,
Software Developer
Follow me on :
http://sandeepmhatre.blogspot.in

Guna27, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response