CHARINDEX is an in-built Sql Server function that accepts two arguments.The first argument is the character which are being searched for and the second parameter is the original string expression.It will return the first index position that the character passed into the first argument which is ...
'DECODE' is not a recognized built-in function name. 'DTEXEC.EXE' is not recognized as an internal or external command, 'gacutil' is not recognized as an internal or external command 'http://schemas.microsoft.com/sqlserver/2004/sqltypes:nvarchar' is not declared, or is not a simple type ...
2 Minimal permissions required to read index size in SQL Server 0 cross database ownership - The server principal is not able to access the database under the current security context 4 Execute Permissions for a Store Procedure that creates databases 3 How to grant...
One issue as a MS SQL Server Database Administrator that I am often faced with is determining the version of the database engine installed on SQL Server. In this tip we look at how to find and read the version of SQL Server that is running the workload and also what service pack, hot...
Is one better than the other? Aging Report SQL Query Alias all columns in a given table Alias column with variable value in SQL Script All MonthNames and Month numbers in sql server All queries combined using a UNION, INTERSECT or EXCEPT operator must have an equal number of expressions in ...
(@owner IS NULL OR TABLE_SCHEMA = @owner) IF @cols_to_include IS NOT NULL --Selecting only user specified columns BEGIN IF CHARINDEX( ''' + SUBSTRING(@Column_Name,2,LEN(@Column_Name)-2) + ''',@cols_to_include) = 0 BEGIN GOTO SKIP_LOOP END END IF @cols_to_exclude IS NOT NU...
In this example 0001 is file Number & 00000130 is Page Number & These numbers are in Hex format*/ SET @Fileid=SUBSTRING(@ConsolidatedPageID,0,CHARINDEX(':',@ConsolidatedPageID)) -- Seperate File ID from Page ID SET @hex_pageid ='0x'+ SUBSTRING(@ConsolidatedPageID,CHARINDEX(':',@Conso...
In other cases, something a bit more exotic needs to happen in the form of a Cross Join with the Tally table like when you want to split a whole column of CSV's. I think that you'll find that no matter what the use is, a Tally table will always beat the pants off ...
value(N'(event/data[@name="wait_resource"]/value)[1]', N'varchar(20)') INTO #t FROM cte CROSS APPLY cte.ed.nodes(N'RingBufferTarget/event') AS x(ed); SELECT obj.name, obj.index_id, count(1) as Occurrences FROM ( SELECT Page_Id = right(t.resource_description, charindex(':'...
IF OBJECT_ID('tempdb..#perfmon_counters') is not null DROP TABLE #perfmon_counters SELECT * INTO #perfmon_counters FROM sys.dm_os_performance_counters -- Get SQL Server instance name SELECT @Instancename = LEFT([object_name], (CHARINDEX(':',[object_name]))) FROM #perfmon_counters WHERE...