March 28, 2011 at 1:21 am
Interesting, Thanks.
March 28, 2011 at 11:13 pm
Nice post! Thanks!
April 2, 2011 at 1:28 am
Nice question. got a good knowledge. thanks:-)
Thanks.
Reji PR,
Bangalore
August 8, 2011 at 1:03 am
pksutha (3/23/2011)
Hi Gopi,select * into TestTable from
(
select CAST(1 as smallint) as C1, CAST(6 as smallint) as C2
union
select CAST(2 as tinyint),CAST(6 as int)
union
select CAST(3 as bigint),CAST(6 as smallint)
union
select CAST(4 as int),CAST(6 as tinyint)
) T
Note: Practically i want to see the difference... will u give example for that..
Hi pksutha,
try this query to see the resulting data type:
SELECT RowID
,Col
,SQL_VARIANT_PROPERTY(Col,'BaseType') BaseType
,SQL_VARIANT_PROPERTY(Col,'Precision') Precision
,SQL_VARIANT_PROPERTY(Col,'Scale') Scale
,SQL_VARIANT_PROPERTY(Col,'TotalBytes') TotalBytes
,SQL_VARIANT_PROPERTY(Col,'Collation') Collation
,SQL_VARIANT_PROPERTY(Col,'MaxLength') MaxLength
FROM (
SELECT 1 AS RowID, CAST(1 AS int) Col
UNION ALL SELECT 2 AS RowID, CAST('2' AS char) Col
)SubQ
And play a little with the datatypes & order of data types in the CASTs to see what the resulting data type will be.
Best Regards,
Chris Büttner
Viewing 4 posts - 46 through 48 (of 48 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy