Thursday, April 6, 2023

MS-SQL Server - Opposite

Opposite

There are so many opposites can be found in SQL server and today some of them are discussed....

1. STRING_AGG and STRING_SPLIT

Concatenates the values of string expressions and places separator values between them. The separator isn't added at the end of string.

STRING_SPLIT

A table-valued function that splits a string into rows of substrings, based on a specified separator character.

Compatibility level 130
STRING_SPLIT requires the compatibility level to be at least 130. When the level is less than 130, SQL Server is unable to find the STRING_SPLIT function.

2. INTERSECT And UNION and EXCEPT

UNION
Concatenates the results of two queries into a single result set.

EXCEPT
Returns any distinct values from the query left of the EXCEPT operator. Those values return as long the right query doesn't return those values as well.

INTERSECT
Returns any distinct values that are returned by both the query on the left and right sides of the INTERSECT operator.

Related Articles

https://learn.microsoft.com/en-us/sql/t-sql/language-elements/set-operators-except-and-intersect-transact-sql?view=sql-server-ver16

https://learn.microsoft.com/en-us/sql/t-sql/language-elements/set-operators-union-transact-sql?view=sql-server-ver16

Additionally,

WaitType Analysis

select * from sys.dm_os_wait_stats where wait_type in ('ASYNC_NETWORK_IO','PAGELATCH_SH','PAGELATCH_EX','PAGEIOLATCH_SH','PAGEIOLATCH_EX','IO_COMPLETION','WRITELOG','ASYNC_IO_COMPLETION','CxPACKET','HADR_FILESTREAM_IOMGR_IOCOMPLETION','OLEDB','MSSQL_XP','LCK_M_IX','LCK_M_X','LCK_M_U','SOS_SCHEDULAR_YIELD','DEADLOCK_ENUM_MUTEX')

There are some waittypes
eg.
GHOSTCLEANUP_UPDATE_STATS &
GHOSTCLEANUPSYNCMGR are for
Internal use only.

Note:- The word 'Drink' is also known as Drop Index of Primary/Unique Key.

Best Regards


T. Amit Vaid S.

No comments: