Dana Stevens

Ruminations of a software developer.
posts - 8, comments - 370, trackbacks - 0

SQL Quick Tip - Determine data type of column.

Use the very nifty SQL_VARIANT_PROPERTY to determine the data type of a returned column.  
Admittedly, it’s faster to look at the table definition in SSMS.  But this is pretty neat.
 
DECLARE @TableVar TABLE (MyColumn numeric(18,5)) 

INSERT INTO @TableVar VALUES (5.5) 

SELECT TOP 1 
     MyColumn, 
     SQL_VARIANT_PROPERTY(MyColumn, 'BaseType') AS 'Base_Type', 
     SQL_VARIANT_PROPERTY(MyColumn, 'Precision') AS 'Precision', 
     SQL_VARIANT_PROPERTY(MyColumn, 'Scale') AS 'Scale' 
FROM @TableVar 

Print | posted on Wednesday, August 13, 2008 12:03 AM |

Feedback

Gravatar

# re: SQL Quick Tip - Determine data type of column.

Would be great if you could a screenshot of the results as well. Thanks for the tip.
8/15/2008 8:04 PM | Mehul Harry
Gravatar

# re: SQL Quick Tip - Determine data type of column.

I feel strongly about it and love learning more on this topic. If possible, as you gain expertise, would you mind updating your blog with more information? It is extremely helpful and beneficial to your readers Nice article.
5/28/2010 7:37 AM | site de jeux gratuits en ligne
Gravatar

# re: SQL Quick Tip - Determine data type of column.

Thanks for the SQL and this is one of the nice and quick tip to find the servers. This is a great article thanks for sharing this informative information. I will visit your blog regularly for some latest post.
10/7/2011 2:17 PM | robbers in Miami beach
Gravatar

# re: SQL Quick Tip - Determine data type of column.

Thanks for the help. When there are too many columns referenced in a query, it becomes difficult to track the data type of each column referenced in that query. Thanks for sharing with us. Real Craigslist buyer Threatened
10/9/2011 3:35 AM | Anna
Gravatar

# re: SQL Quick Tip - Determine data type of column.

i very very like your blog.it is usefull for us.thank
11/29/2011 2:19 AM | ugg boots cheap
Gravatar

# celine bags

good article
1/4/2012 8:10 PM | celine bags
Gravatar

# celine bags

good article.i like it
1/4/2012 8:11 PM | celine bags
Gravatar

# re: SQL Quick Tip - Determine data type of column.

good from your side
3/16/2012 11:37 AM | aster
Gravatar

# re: SQL Quick Tip - Determine data type of column.

Useless scrypt.
4/5/2012 4:15 AM | buy essay papers
Gravatar

# re: SQL Quick Tip - Determine data type of column.

It seems to be someone wanted to kill Christian Louboutin outlet your father emperor, we just can catch up with it!" ZhouBao qq light moved to around the palace, in white and gold beam Gang gas impact,Louboutin outlet the whole into the palace has been made, the waves of Gang gas and white christian louboutin pumps beam out air will collide bluestone ground is completely turned to open, and showed christian louboutin sandals a deep Nick below.

6/17/2012 11:45 PM | Christian Louboutin outlet
Gravatar

# re: SQL Quick Tip - Determine data type of column.

便利な着脱可能で、それが可能、参加者がフィールドにかかわらず徹底的なグリップを持っていたために作るスタッドにインストールされている他の屋外のデザインがあります. 端側でスタッドで利用できるがある. soccer union これらのレビュー靴は、トラクションを使用して非常に優れたグリップ力があるように全くなく茂みの中でシンクします. 彼らも用語代理町でそれ有益な変化を与えることができますしながら、これらのソートが楽しい理由で打者のために非常に最適です. すべてのそれらの人々取り外し可能な人を含む人々は、彼らが多くの分野と同様に沿って気温が例になるように調節することができるようになりますので、洗練された人々によって利用される最も大きくなります. 彼らは、プラスチック製の靴底彼らの最高のグリップを与えるあなたのウェブサイトのスチールポイントを含んでいる. 素敵なポイントは、それが思春期のゲーマーのノウハウを得ることを、事前にそれらを身に着けて起動しないようにしたいことを巣に運ぶことが重要である一方、これらのデザインは、ターン気候ソートで変更するALTERだろう予測している.
8/24/2012 11:31 PM | urpisfuchoo1978
Gravatar

# re: SQL Quick Tip - Determine data type of column.

便利な着脱可能で、それが可能、参加者がフィールドにかかわらず徹底的なグリップを持っていたために作るスタッドにインストールされている他の屋外のデザインがあります. 端側でスタッドで利用できるがある. これらのレビュー靴は、トラクションを使用して非常に優れたグリップ力があるように全くなく茂みの中でシンクします. 彼らも用語代理町でそれ有益な変化を与えることができますしながら、これらのソートが楽しい理由で打者のために非常に最適です. すべてのそれらの人々取り外し可能な人を含む人々は、彼らが多くの分野と同様に沿って気温が例になるように調節することができるようになりますので、洗練された人々によって利用される最も大きくなります. 彼らは、プラスチック製の靴底彼らの最高のグリップを与えるあなたのウェブサイトのスチールポイントを含んでいる. 素敵なポイントは、それが思春期のゲーマーのノウハウを得ることを、事前にそれらを身に着けて起動しないようにしたいことを巣に運ぶことが重要である一方、これらのデザインは、ターン気候ソートで変更するALTERだろう予測している.
8/24/2012 11:35 PM | urpisfuchoo1978
Gravatar

# re: SQL Quick Tip - Determine data type of column.

Thank you very much for you can share your post,the article content written very well,extremely is worth my study
9/24/2012 10:00 PM | best ipad keyboard
Gravatar

# re: SQL Quick Tip - Determine data type of column.


Thank you for making the effort to go over this, Personally i think strongly about this and love learning more about this subject. If at all possible, while you gain expertise, can you mind upgrading your site with increased information? It's very useful for me personally.
2/22/2013 3:18 AM | Cheap iPhone 4 Cases
Gravatar

# re: SQL Quick Tip - Determine data type of column.

This really is such a great resource that you're offering and also you provide away cost-free. It provides detailed particulars. Thank you for this helpful particulars.
2/22/2013 3:19 AM | Cheap iPhone 4 Cases
Gravatar

# re: SQL Quick Tip - Determine data type of column.

We considerably love this kind of web-site .I really will certainly return again.I recieve a great deal lately it's producing me angry thus any there's help considerably appreciated.
2/23/2013 3:10 AM | Cheap USB Flash Drives
Gravatar

# re: SQL Quick Tip - Determine data type of column.

Useful read shared in this thread having great useful material which is much helpful one for many persons to required knowledge.
3/13/2013 5:34 AM | Replica Watches
Gravatar

# re: SQL Quick Tip - Determine data type of column.

That was really nice site. In fact, I love that site. And I invite my friends to become a member of that new community that you share in here.DEMI
4/6/2013 10:17 PM | OBDII Code Info
Gravatar

# re: SQL Quick Tip - Determine data type of column.

BBB's Business Review for ahappydeal.com, Business Reviews and Ratings for Ahappydeal.com in Woodland, CA.
4/11/2013 2:07 AM | ahappydeal.com
Gravatar

# Lexia-3 Pour Citroën

lexia 3 de pps pour citroen peugeot Software,lexia 3 de pps pour citroen peugeot Download,lexia 3 de pps pour citroen peugeot Software Download,lexia 3 de ...
6/18/2013 3:24 AM | Lexia-3 Pour Citroën
Gravatar

# re: SQL Quick Tip - Determine data type of column.

With thanks for approximately another thing this is not a little too not doing anything to publish your content. In the article, adequately reserved precious advice in my opinion, as well as looks at the woman accurate but additionally worth coming from all plans referrals. For certain i will distribute your switch with his others who live nearby, I am sure it might be would always the application, kudos.
8/19/2013 12:28 PM | write my papers
Gravatar

# re: SQL Quick Tip - Determine data type of column.

or approximately another thing this is not a little too not doing anything to publish your content. In the article, adequately reserved precious advice in my opinion, as well as looks at the woman accurate but additionally worth coming from all plans referrals. For certain i will distribute your switch wi
9/25/2013 3:30 AM | dash cameras
Gravatar

# re: SQL Quick Tip - Determine data type of column.


SQL_VARIANT_PROPERTY(MyColumn, 'BaseType') AS 'Base_Type',
SQL_VARIANT_PROPERTY(MyColumn, 'Precision') AS 'Precision',
SQL_VARIANT_PROPERTY(MyColumn, 'Scale') AS 'Scale'
FROM @TableVar
9/25/2013 3:31 AM | dash cameras
Gravatar

# re: SQL Quick Tip - Determine data type of column.

SQL_VA_PRr _PROPEOPERTY(MyColumn, 'BaseType') AS 'Base_Type',
SQL_VARIANTPERTY(MyColumn, 'Scale') AS 'Scale'
FROM @TableVaRTY(MyColumn, 'Precision') AS 'Precision',
SQL_VARIANT_PRORIANT
9/25/2013 3:31 AM | dash cameras
Gravatar

# Outil de scan OBD2

OBDII.FR-leader dans le domaine du diagnostique ,outils diagnostic automobile sur le marché French, nous proposons des produits, OBDII,Outil de scan OBD2,Outil de Scan Automobile, etc.
4/13/2014 10:44 PM | Outil de scan OBD2

Post Comment

Title  
Name  
Email
Url
Comment   
Please add 1 and 3 and type the answer here:

Powered by:
Powered By Subtext Powered By ASP.NET