Skip to main content

Posts

Showing posts with the label SQL2016

what is TRY_CAST in sql server

This is the new function introduced with 2016 version of SQL Server. This is used to cast value from its existing data type to a specified target data type. This occurs only if the operation is successful. It returns NULL if the conversion fails. TRY_CAST is an extended version of the CAST function. Query SELECT CAST ( 'Tech-Recipes' as INT ) as CastExample ; result Msg 245 , Level 16 , State 1 , Line 2 Conversion failed when converting the varchar value 'Tech-Recipes' to data type int . query SELECT CAST ( '12' as INT ) as CastExample ; result 12 SELECT TRY_CAST ( 'Tech-Recipes' as INT ) as CastExample ; Result NULL SELECT TRY_CAST ( '20' as INT ) as CastExample ; Result 20

What is String_Split in sql server

This is new built-in table-valued function introduced in sql server 2016. STRING_SPLIT that splits the provided input string by a specified separation character and returns the output separated values in the form of table. This is usefull-function that you might always use userdefined long and unoptimized function in most applications. Now sql server have built in function to split the text. Query SELECT * FROM STRING_SPLIT('Suman,Satyam,Shivam',',') Result Suman Satyam Shivam Thanks for reading Plz dont forget to like Facebook Page.. https://www.facebook.com/pages/Sql-DBAcoin/523110684456757

DBCC Clone Database in SQL Server 2016

What is DBCC Clone Database in SQL 2016 ? During Database development many times we required to create exact copy of database without data. This command is used to creating a database clone is fast and easy way for such kind of requirements.  The main important feature and benefits of clone database is it copy entire objects, metadata and statistics from the specified source database without any data. Here is the command to create clone. DBCC CLONEDATABASE (YoungDBA2016, YoungDBA2016_Clone) What are the operation being process when we start cloning database ? When we configure dbcc clone database it does following operations: It Creates a new destination database that uses the same file layout as the source. Then an internal snapshot of the source database. After that it copies the system metadata from the source to the destination database. Then it copies all schema for all objects. Then it copies statistics for all indexes. Does it requires any Services packs for