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 2008 Forums
 Transact-SQL (2008)
 datatype
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

arkiboys
Flowing Fount of Yak Knowledge

1341 Posts

Posted - 08/07/2012 :  10:50:32  Show Profile  Reply with Quote
Hi,
Why can I only enter an integer here and not a float?
Note that I would like to have the "into" statement
so that the table is built.
Thanks

select
ID,
name,
figure = null
into ##tbltest
from
tblMain

update ##tbltest set figure = 123.54

select * from ##tbltest
drop table ##tbltest

robvolk
Most Valuable Yak

USA
15559 Posts

Posted - 08/07/2012 :  11:11:21  Show Profile  Visit robvolk's Homepage  Reply with Quote
select ID, name, figure = cast(null as float)
into ##tbltest
from tblMain
Go to Top of Page

arkiboys
Flowing Fount of Yak Knowledge

1341 Posts

Posted - 08/07/2012 :  11:35:55  Show Profile  Reply with Quote
thanks
Go to Top of Page

madhivanan
Premature Yak Congratulator

India
22460 Posts

Posted - 08/16/2012 :  10:43:25  Show Profile  Send madhivanan a Yahoo! Message  Reply with Quote
It is because the default DATATYPE is INT unless if it is converted differently
http://beyondrelational.com/modules/2/blogs/70/posts/10982/default-datatype-of-null.aspx

Madhivanan

Failing to plan is Planning to fail
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.07 seconds. Powered By: Snitz Forums 2000