VistaDB 5
CAST
Explicitly converts an expression of one data type to another.

CAST ( expression as data_type[ (length) ] )

select CAST( 193.97 as varbinary(20))

SQL Server Differences

We do not implement all the special rules and behavior exceptions of SQL Server. Since we are .Net based we rely on conversions in .Net to work.

SELECT CONVERT( DATETIME, 0); -- Does not work

0 Does not convert to a datetime in .Net.

For an example of how large and complex these rules are in SQL Server look at this MSDN CAST and CONVERT topic.

We do not support those same rules. These are in many cases behaviors specific to builds of SQL Server (they have changed in SP's before). If you are running into cast or convert errors try to think in terms of explicit declaration.



Remarks

CAST and CONVERT provide similar functionality

Example

select CAST( 193.97 as bigint)

Returns: 193

See Also