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
 General SQL Server Forums
 New to SQL Server Programming
 Alias Data Type

Author  Topic 

mmkrishna1919
Yak Posting Veteran

95 Posts

Posted - 2013-04-26 : 01:11:28
Hi All,

while i was reading about AVG function i came across below statement

"However, if the base data type of the alias data type is promoted, for example from tinyint to int, the return value is of the promoted data type and not the alias data type."

Link: <<http://msdn.microsoft.com/en-us/library/ms177677.aspx>>

Here how can we promote base data type from tinyint to int?

Thanks,
M.MURALI kRISHNA

chadmat
The Chadinator

1974 Posts

Posted - 2013-04-26 : 01:32:57
It happens implicitly as per the table in the link you posted (just above the quoted comment.

-Chad
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-04-26 : 01:36:05
tinyint to int happens automatically.
however in cases like int to decimal etc you've to do it using explicit or implicit conversion.





------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

mmkrishna1919
Yak Posting Veteran

95 Posts

Posted - 2013-04-26 : 01:51:02
Chad/visakh Thanks for reply.





M.MURALI kRISHNA
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-04-26 : 01:57:32
welcome

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page
   

- Advertisement -