convert in sql code example

Example 1: sql server convert string to date

Cast( '2011-07-07' as date ) as convertedDate

Example 2: select CONVERT(NUMber(10,2),dailybroadbandusagedsmbyte)

select CONVERT(NUMber(10,2),dailybroadbandusagedsmbyte)

Example 3: convert money to varchar sql server

SELECT convert(varchar(30), moneyfield, 1)

Example 4: sql convert

-- CAST Syntax:  
CAST ( expression AS data_type [ ( length ) ] )  
  
-- CONVERT Syntax:  
CONVERT ( data_type [ ( length ) ] , expression [ , style ] )