Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 calculate real numbers

Author  Topic 

gagani
Posting Yak Master

112 Posts

Posted - 2014-10-29 : 11:14:18
create PROCEDURE sampleprocdure1
@zx decimal,
@zurg decimal
AS
BEGIN
declare @Return decimal


Set @Return = @zx + @zurg
print @Return;

return @Return
END

GO

EXEC [dbo].[sampleprocdure1] @zx = 7.2196434,
@zurg= 0.30;

I am getting the output at 7.

How to get the output as 7.5196434?
what changes I need to do to the stored procedure?

AASC
Starting Member

24 Posts

Posted - 2014-10-29 : 11:44:28
@Gagani your are missing Precision and Scaling parameter to Decimal data type of SQl Server.

http://msdn.microsoft.com/en-us/library/ms187746.aspx

alter PROCEDURE sampleprocdure1
@zx decimal(15,7),
@zurg decimal(15,7)
AS
BEGIN
declare @Return decimal(15,7)


Set @Return = @zx + @zurg
print @Return;

return @Return
END

GO[url][/url]
Go to Top of Page
   

- Advertisement -