Data Type Conversion

T-SQL's data types don’t map one-to-one with data types in other programming languages.

James T. Stanley

August 11, 2000

1 Min Read
ITPro Today logo in a gray background | ITPro Today

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.

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like