Sql Server 2012 many new features to the T-SQL. Some were just added from other languages and platforms to ease the transition to SQL.
Others were added to provide very powerful, new way to solve complex problems
Lets see examples of one of the feature of TRY_CONVERT().
TRY_CONVERT()
Some time CONVERT() and ISNUMERIC() is not always reliable, So values that return are not convertible to all numeric types.
SELECT CONVERT(INT, column1) FROM Temp WHERE ISNUMERIC(column1) = 1
So for above statement sometime that will fail for values like 'abc' which are considered numeric but can not be converted to an integer.
but TRY_CONVERT() will give the result of value 'abc' return NULL instead of returning an error for the entire query.
Syntax:
TRY_CAST ( expression AS data_type [ ( length ) ] )
expression
The value to be cast. Any valid expression.
data_type
The data type into which to cast expression.
length
Optional integer that specifies the length of the target data type.
The range of acceptable values is determined by the value of data_type.
Others were added to provide very powerful, new way to solve complex problems
Lets see examples of one of the feature of TRY_CONVERT().
TRY_CONVERT()
Some time CONVERT() and ISNUMERIC() is not always reliable, So values that return are not convertible to all numeric types.
SELECT CONVERT(INT, column1) FROM Temp WHERE ISNUMERIC(column1) = 1
So for above statement sometime that will fail for values like 'abc' which are considered numeric but can not be converted to an integer.
but TRY_CONVERT() will give the result of value 'abc' return NULL instead of returning an error for the entire query.
Syntax:
TRY_CAST ( expression AS data_type [ ( length ) ] )
expression
The value to be cast. Any valid expression.
data_type
The data type into which to cast expression.
length
Optional integer that specifies the length of the target data type.
The range of acceptable values is determined by the value of data_type.
Online Casino - Karnataka - Play Online Casino Games
ReplyDeleteJoin us today to get 더킹카지노 도메인 free 샌즈 money, casino games, and 온카지노 exclusive promotions at online casinos bet365 in Karnataka. Enjoy casino slots, live casino games and 메리트 카지노 가입 쿠폰 more.