SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Insert Float Value into Table in SQL server 2000
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

ranjeetsingh_6
Posting Yak Master

India
125 Posts

Posted - 08/11/2006 :  03:32:01  Show Profile  Reply with Quote
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)

Singapore
17681 Posts

Posted - 08/11/2006 :  03:35:21  Show Profile  Reply with Quote
Did you try this ?

insert into tblamount (flttotal_Amount) values(12)



KH

Go to Top of Page

ranjeetsingh_6
Posting Yak Master

India
125 Posts

Posted - 08/11/2006 :  04:02:37  Show Profile  Reply with Quote
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)

Singapore
17681 Posts

Posted - 08/11/2006 :  04:04:32  Show Profile  Reply with Quote
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

India
125 Posts

Posted - 08/11/2006 :  04:25:55  Show Profile  Reply with Quote
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)

Singapore
17681 Posts

Posted - 08/11/2006 :  04:34:47  Show Profile  Reply with Quote
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



KH

Go to Top of Page

ranjeetsingh_6
Posting Yak Master

India
125 Posts

Posted - 08/11/2006 :  04:57:05  Show Profile  Reply with Quote
Thanks Problem have solved

Ranjeet Kumar Singh
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.08 seconds. Powered By: Snitz Forums 2000