Monday, June 4, 2012

SQL Server 2012 - New Functions...

With the release of SQL Server 2012, there are lot of new user defined functions which have been introduced in T-SQL. One of the popular or more used functions are CAST and CONVERT, these are used to perform conversion of data from one data type to another. There is a new function which has been introduced in SQL Server 2012 called PARSE. It has the following Syntax:

PARSE ( string_value AS data_type [ USING culture ] )
PARSE(), expects three parameters,
string_value – String value to parse into the specified data type.
data_type – Return data type, numeric or datetime type
culture – A language (English, Japanese, Spanish, Danish, French etc.) which will used by SQL Server to interpret data.
SELECT PARSE(’23/04/2012′ AS datetime2 USING ‘en-GB’) AS [Using PARSE Function]

There are more functions which are described in detail in this article:

No comments:

Post a Comment