Data Type Conversion

T-SQL's data types don't map one-to-one to data types in other programming languages. Thus, you need to know what data types other languages convert SQL Server data into and what data types SQL Server uses when non-SQL Server data enters SQL Server as parameters and return values. Table A shows what SQL Server data types map to in Visual Basic (VB), and Table B shows what VB data types map to in SQL Server. Note that SQL Server doesn't automatically force you to use the correct data type. If you're calling an object method that expects a string parameter, you must pass a string literal or another data type that converts to a string. Also note that when you send NULL values to VB, the object will receive the values as null Variants. If a property or method returns another object, you should use a variable of type int. In this case, the returned value will be an object token, which lets you automate the returned object as though you had explicitly created it by using stored procedure sp_OACreate.

Please or Register to post comments.

IT/Dev Connections

Las Vegas
September 30th - October 4th

Paul ThurottOur Experts will show you:
• Common SQL Server
Problems
• Best Practices for T-SQL
• SQL Server Integration
Services
• Database Development

Come See Mike Otey & Tim Ford in Person!

Early Registration Now Open

From the Blogs
May 9, 2013
blog

My ISO 8601-Compliant Signature 2

My family recently just "officially" announced that we're in the process of adopting a child from South Africa. We're quite excited, of course, but there's a ton of paperwork to do—along with the need for gobs of signatures....More
May 8, 2013
blog

Use SSIS for ETL from Hadoop

In this blog post, Mark Kromer walks you through using SSIS as a way to use ETL techniques using Microsoft's Hadoop on Windows (HDInsight) as a source using Hive connectors...More
Vision road sign
May 6, 2013
blog

Cheaters Never Win, Even in TPC Benchmarks

In this portion of the series on database benchmarking, I want to tell you about one of my favorite aspects of the TPC benchmarks – CHEATING....More
SQL Server Pro Forums

Get answers to questions, share tips, and engage with the SQL Server community in our Forums.