Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sending decimal data type to Sql Server

Status
Not open for further replies.

siraj777

Programmer
Aug 22, 2002
27
IN
HI,

I am using Powerbuilder 6.5 and MS SQL Server 7.0

I am calling stored procedure with an argument of decimal data type.

Decimal ldc_hours
ldc_hours = dw_1.GetItemDecimal(1,"hours")

sp_hours(ldc_hours)

In Sql Server
Procedure <name>
hours decimal(6,1) AS
<etc.,>

Now the real problem: If I send 3.9 from PB; SQL SERVER is accepting 3 (ignoring the decimal position)

I tried using numeric(6,1) in sql server too.
 
Can you change the stored procedure parameter to be data type 'real' or 'float'? Real and Float data types are approximate data types as opposed to decimal types which contain exact precision. You can use SQL Server 6.5/7 Online Books and read up on data types real, float, and decimal.

Also, you can test whether PB is not passing the parameter properly by invoking the stored procedure via MS Query Analyzer.

Good Luck
 
Thanks for your reply.

The above problem was solved by sending string type data from PowerBuilder and converting back to decimal inside the stored procedure.

set @hoursdec = convert(decimal(6,1),@hours)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top