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.

Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish