September 24, 2007 at 9:01 am
noeld (9/24/2007)
Honestly I don't understand how much faster do you get when BOL has the "return type" and is very easy to bookmark/use 😉
Yup... I agree... said something similar above.
--Jeff Moden
Change is inevitable... Change for the better is not.
September 24, 2007 at 9:02 am
Ninja's_RGR'us (9/24/2007)
As I said, while IT DOESN'T help for this case... that function has a lot of good info...:).
Ah... got it... thought you'd stumbled into something cool. Thanks, Remi.
--Jeff Moden
Change is inevitable... Change for the better is not.
September 24, 2007 at 9:15 am
Nah, I wish.... maybe in Katmai. Anyone has access to those books online?? I have not installed the ctp yet!
September 24, 2007 at 9:58 pm
In response to the original post,
From my past experiences, this is the closest example I can think of. The example uses SQL_Variant_Property() System MetaData Function, which should be present in both SQL Server 2000 and SQL Server 2005.
Link to documentation from Microsoft:
http://msdn2.microsoft.com/en-us/library/ms178550.aspx
Example:
declare
@date datetime
declare
@int int
set
@date=getdate()
set
@int=15
SELECT
@date as 'Data',SQL_VARIANT_PROPERTY(@date,'BaseType') AS 'Base Type'
SELECT
@int as 'Data',SQL_VARIANT_PROPERTY(@int,'BaseType') AS 'Base Type'
SELECT
@@ServerName as 'Data',SQL_VARIANT_PROPERTY(@@ServerName,'BaseType') AS 'Base Type'
Regards,
Wameng Vang
MCTS
September 24, 2007 at 10:27 pm
Quick and dirty. Nice solution. I still don't know why I'd use this but I'll keep it in mind just in case :).
September 24, 2007 at 10:34 pm
Thanks
MCTS
September 24, 2007 at 10:45 pm
It works perfectly for all datatypes allowing implicit conversion to SQL_VARIANT.
This is true for almost all datatypes excluding timestamp, image, text and ntext.
It will fail for those types.
And for "char" and "decimal/numeric" datatypes you'll probably need to query 'Precision' and 'Scale' properties as well.
_____________
Code for TallyGenerator
September 24, 2007 at 11:14 pm
Looks like someone read the documentation.... awesome... LOLz....
MCTS
September 24, 2007 at 11:52 pm
It's something my fingers can do even I'm asleep:
F1 -> C+A+S+T -> Enter -> Enter
🙂
_____________
Code for TallyGenerator
September 25, 2007 at 12:00 am
Heh... lemme change my stance on this subject ...
I pretty sure there's something built in ... 😀
--Jeff Moden
Change is inevitable... Change for the better is not.
September 25, 2007 at 4:59 am
Damn Jeff, I wish as was as smart as you :P.
Viewing 11 posts - 16 through 25 (of 25 total)
You must be logged in to reply to this topic. Login to reply