Posts

Showing posts from October, 2020

String Split

create function fnStringSplit (        @str   Varchar ( 100 ),        @delimiter   Varchar ( 1 ) ) returns @Temp   Table ( item varchar ( 100 )) AS begin --Declare @str as Varchar(100) = 'DXB-DEL/DEL-DXB/DEL-HYD/HYD-BLR' --Declare @delimiter As Varchar(1)='/' Declare @i as int = 0 Declare @j as int = 0 Set @j = ( Len ( @str ) - len ( REPLACE ( @str , @delimiter , '' ))) While @i   < = @j Begin   if @i   < @j   Begin       Insert into @Temp       Values ( SUBSTRING ( @str , 1 , Charindex ( @delimiter , @str , 1 )- 1 ))       set @str = right( @str ,( len ( @str )- Charindex ( @delimiter , @str , 1 )))   End   Else   Begin      Insert into @Temp Values ( @str )   End   Set @i = @i + 1 End --S...

SQL System Tables

Mapping System Tables to System Views   System table System views or functions sysaltfiles sys.master_files syscacheobjects sys.dm_exec_cached_plans sys.dm_exec_plan_attributes (Transact-SQL) sys.dm_exec_sql_text sys.dm_exec_cached_plan_dependent_objects syscharsets sys.syscharsets sysconfigures sys.configurations syscurconfigs sys.configurations sysdatabases sys.databases sysdevices sys.backup_devices syslanguages sys.syslanguages syslockinfo sys.dm_tran_locks syslocks sys.dm_tran_locks syslogins sys.server_principals sys.sql_logins sysmessages sys.messages sysoledbusers sys.linked_logins sysopentapes sys.dm_io_backup_tapes ...