Count string Items
This script will return how many time one string occurs within another. It will only work on SQL 2K as it is a UDF, but it could be converted to a stored proc with a output variable for SQL 7.0.
2002-11-15
344 reads
This script will return how many time one string occurs within another. It will only work on SQL 2K as it is a UDF, but it could be converted to a stored proc with a output variable for SQL 7.0.
2002-11-15
344 reads
ps_SearchStoredProcedures provides a "find utility" to search for string in Stored Procedure(s) that you select without dumping to a SQL script file. This stored procedure returns a list of the stored procedures that the string was found in and list of line numbers where the text was found. Both parameters of the stored procedure allow […]
2002-11-15
404 reads
This UDF will take a delimited string and split it into a table. It has an identity field that is provided solely for uniqueness on the rows, but that can be removed to improve the speed, and optimize it. Sample call :dbo.fnSplit(, )@Data - the string to split apart@Delimiter - the seperator string, if DEFAULT […]
2002-11-15
1,118 reads
Runs a SQL statement against each database based on a LIKE pattern for the name of the database.Features:* IsLike and IsNotLike parameters let you specify both a matching pattern and an exclusion pattern for the database name.* Script_Only mode generates the script of what the stored proc executes. Especially useful for DDL statements.* List_Only mode […]
2002-11-14
393 reads
Have you ever wanted to check that a server exists before using it. Here is a solution that use SQLDMO from within TSQL to get the status of a SQL Server service. It also works for 2000 instances. I have named it sp_ServerStatus for it to be based in master.This returns the status integer and […]
2002-11-14
604 reads
Do you want to use OPENXML with an xml document in a table, this procdure will do it for you.Pass in the SQL that will return the column of data, it will return the document handle which can then be used with OPENXML.ExampleDROP TABLE TabCREATE TABLE Tab (doc ntext)INSERT INTO Tab VALUES ('' + REPLICATE('' […]
2002-11-14
528 reads
This function and stored procedure can be used to easily identify if a file, directory or parent directory exist. It wraps the functionality of xp_fileExist but gives easy access to the directory and parent directory exist values.To use it the function pass in the file or path and either 'IsFile', 'IsDir' or 'HasParentDir' it will […]
2002-11-13
3,821 reads
The procedure copies one stored procedure from one database to another one
2002-11-12
710 reads
INSTR searches string for substring. --> position is an integer indicating the character of string where SQL Server begins the search. -->If position is negative, SQL Server counts and searches backward from the end of string. occurrence is an integer indicating which occurrence of string SQL Server should search for. The value of occurrence must […]
2002-11-12
1,348 reads
This stored proc has helped me a lot when I needed to restore db, reconfigure replication, and do other database jobs. SQL server KILL command can only act on a single spid. This sp compiles KILL commands in a cursor to kill a group of spids based on database name, login name, host machine name […]
2002-11-11
5,992 reads
Welcome back, my fellow sleuths, to my mystery-inspired blog series! I’m having a ton...
By Steve Jones
This was one of the original values: The facing page has this text: No...
By Chris Yates
For decades, enterprises have thought about data like plumbers think about water: you build...
Comments posted to this topic are about the item Create an HTML Report on...
Hi everyone I have a 1000 plus line query and I am getting an...
Comments posted to this topic are about the item Building a RESTful API with...
What happens when I run this code:
DECLARE @s VARCHAR(1000) = 'apple, pear, peach' SELECT * FROM STRING_SPLIT(@s, ', ')See possible answers