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)
 Union all for different data types

Author  Topic 

jung1975
Aged Yak Warrior

503 Posts

Posted - 2004-07-10 : 20:05:54

Select A as A from dummy1 -- the data type of A is int

Union all

Select B as A from dummy2 -- the data type of B is float

It returns
A
-----
340.00
0.78

How can I return the result looks like:

A
----
340
0.78




derrickleggett
Pointy Haired Yak DBA

4184 Posts

Posted - 2004-07-10 : 21:04:23
You can't. It's a display issue and should be handled in your application. You need to go with the most common type in SQL which is float. I really wouldn't be using float at all though. You really should use decimal(5,2) or something for this. For more information on datatypes, look them up in SQL Server Books Online. Float doesn't have exact precision and should only be used when absolutely necessary.

MeanOldDBA
derrickleggett@hotmail.com

When life gives you a lemon, fire the DBA.
Go to Top of Page
   

- Advertisement -