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
 gettype of an expression.

Author  Topic 

mathmax
Yak Posting Veteran

95 Posts

Posted - 2008-07-16 : 12:10:54
Hello,

Is there a TSQL function that return the type of an expression ?

Thanks

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-07-16 : 12:18:14
by type do you mean arithmetic,...
Go to Top of Page

mathmax
Yak Posting Veteran

95 Posts

Posted - 2008-07-16 : 12:20:02
T-SQL types : char, int, datetime,...
Go to Top of Page

elancaster
A very urgent SQL Yakette

1208 Posts

Posted - 2008-07-16 : 14:06:25
so datatype? ...now what do you mean by datatype of an expression?

Em
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-07-16 : 14:09:33
quote:
Originally posted by elancaster

so datatype? ...now what do you mean by datatype of an expression?

Em


i think he's asking for return type of expression
Go to Top of Page

mathmax
Yak Posting Veteran

95 Posts

Posted - 2008-07-16 : 14:30:31
Yes research a function that returns the following result:
valtype('astring') -> 'char'
valtype(1) -> 'int'
valtype(id) -> 'int'
valtype(getdate()) -> 'datetime'
Go to Top of Page

Lamprey
Master Smack Fu Yak Hacker

4614 Posts

Posted - 2008-07-16 : 16:24:25
Nothing that I know of..

Out of curiosity, why do you want this functionality? Every SQL "object" is typed so there is no need for this sort of function. However, maybe you are doing something exotic..? Just curious.
Go to Top of Page
   

- Advertisement -