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 2008 Forums
 Transact-SQL (2008)
 datatype

Author  Topic 

arkiboys
Master Smack Fu Yak Hacker

1433 Posts

Posted - 2012-08-07 : 10:50:32
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

15732 Posts

Posted - 2012-08-07 : 11:11:21
select ID, name, figure = cast(null as float)
into ##tbltest
from tblMain
Go to Top of Page

arkiboys
Master Smack Fu Yak Hacker

1433 Posts

Posted - 2012-08-07 : 11:35:55
thanks
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2012-08-16 : 10:43:25
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
   

- Advertisement -