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
 SQL Server 2000 Forums
 SQL Server Development (2000)
 why cannot insert decimal number to sql server 7?

Author  Topic 

dogli
Starting Member

32 Posts

Posted - 2002-12-02 : 14:38:32
Hi gurus here,

This questions may be too simple to ask here. If it is, don't laugh at me. I have searched and real all related articles in this forum as long as BOL, but just did not find the answer.

what I want to do is to insert a decimal number to a sql server 7 database. The number is got from a form in ASP page, and I use the stored procedure.

my question is that I cannot insert it successfully. IF I put 1.2 in the form, the data inserted in the table is 1.

Just don't know how to do. Help me, please.

Thank you so much

KHeon
Posting Yak Master

135 Posts

Posted - 2002-12-02 : 14:44:13
I'd check to make sure the precision is set properly in the database. Other then that, I vaguely remember an issue with decimals. How are you passing to the stored procedure? Are you using a command object or doing it through SQL syntax (ie: EXEC usp_StoredProc @param1=1.2)?

Kyle Heon
PixelMEDIA, Inc.
Senior Application Programmer, MCP
kheon@pixelmedia.com
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2002-12-02 : 15:05:04
Also make sure that the column isn't an int, smallint, or tinyint, they don't accept decimals at all.

Go to Top of Page

dogli
Starting Member

32 Posts

Posted - 2002-12-02 : 15:27:04
Thanks guys for your reply. I have checked column and make sure it is deciaml with (10,2). Actually, I can insert the decimal number to column if exec it in Query Analyzer. But if I exec in the ASP page, I cannot pass the decimal value to the database.

BTW, I use the exec spname 'para' to execute the sp. It seems that I have to use the command where I can specify the parameter. I will try the commmand and report the result here.

Thanks again.

Go to Top of Page

dogli
Starting Member

32 Posts

Posted - 2002-12-02 : 15:37:15
sorry, guys, I got the answer. I modified the code writen by ohters, and there is some place in the old code to set up the varible as int!!!!

Thank very much, anyway!

Go to Top of Page

dogli
Starting Member

32 Posts

Posted - 2002-12-02 : 15:38:45
can somebody delete this post please? I just don't want waster other guys time to read it any more.

Thanks

Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2002-12-02 : 15:57:29
Nah, we'll leave it. It's a good example of checking everything. Besides, you can always claim it was the previous developer's fault!

Go to Top of Page
   

- Advertisement -