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
 Transact-SQL (2000)
 Insert Float Value into Table in SQL server 2000

Author  Topic 

ranjeetsingh_6
Posting Yak Master

125 Posts

Posted - 2006-08-11 : 03:32:01
Hi I have a Table and this table contain a column flttotal_Amount
this column Datatype is Float.I use this table for insert value.I Want when i will insert any integer valu in this column it should be inserted as its Float value Means when i insert into this value
12 then 12.00 should inserted.
I Want This

I am inserting Value in my Tables's Column By this Query

insert into tblamount values(12)

and I want The value store in DataBase 12.00

If Function ,store procedure or trigger will use then send code Plz

Ranjeet Kumar Singh

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-08-11 : 03:35:21
Did you try this ?

insert into tblamount (flttotal_Amount) values(12)



KH

Go to Top of Page

ranjeetsingh_6
Posting Yak Master

125 Posts

Posted - 2006-08-11 : 04:02:37
yes i am using this
insert into tblamount (flttotal_Amount) values(12)
my main prob is i am inserting integer value and want to store as a float. table column's datatype is float.


Ranjeet Kumar Singh
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-08-11 : 04:04:32
did you try select * from tblamount ?
as the data type is float, the data will be stored as floating point value.


KH

Go to Top of Page

ranjeetsingh_6
Posting Yak Master

125 Posts

Posted - 2006-08-11 : 04:25:55
yes I have use
select * from tblamount

and Find OUTPUT

12

But i want this output

12.00

Value inserted correctlly But output comes accordig to input value when i want always float value For Example:

if i insert in table vales 212,23,23,12
then Output 212.00,23.00,12.00



Ranjeet Kumar Singh
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-08-11 : 04:34:47
[code]create table #tblamount
(
flttotal_amount float
)

insert into #tblamount select 212
insert into #tblamount select 23
insert into #tblamount select 23
insert into #tblamount select 12

select * from #tblamount

/*
flttotal_amount
---------------
212.0
23.0
23.0
12.0

(4 row(s) affected)
*/

drop table #tblamount[/code]


KH

Go to Top of Page

ranjeetsingh_6
Posting Yak Master

125 Posts

Posted - 2006-08-11 : 04:57:05
Thanks Problem have solved

Ranjeet Kumar Singh
Go to Top of Page
   

- Advertisement -