This improved Split function allows for multi-byte delimiters, optional null values, and optional null value substitution.
2007-10-02 (first published: 2002-06-20)
15,403 reads
Elmer-Miller,
2007-09-10 (first published: 2007-05-01)
This improved Split function allows for multi-byte delimiters, optional null values, and optional null value substitution.
IF EXISTS(SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[fnSplit]')) DROP FUNCTION [dbo].fnSplit GO --This UDF will split a delimited list into a table. CREATE FUNCTION dbo.fnSplit ( @list NVARCHAR(4000) , @delimiter NVARCHAR(10) = N',' , @include_null BIT = 0 , @null_text NVARCHAR(10) = NULL ) RETURNS @tableList TABLE( idx SMALLINT IDENTITY (1,1) PRIMARY KEY, value NVARCHAR(100) NULL ) AS BEGIN DECLARE @value NVARCHAR(100) DECLARE @position INT SET @list = LTRIM(RTRIM(@list))+ @delimiter SET @position = CHARINDEX(@delimiter, @list, 1) IF REPLACE(@list, @delimiter, '') <> '' BEGIN WHILE @position > 0 BEGIN SET @value = LTRIM(RTRIM(LEFT(@list, @position - 1))) IF @include_null = 1 OR @value <> '' BEGIN IF @value = '' SET @value = @null_text INSERT INTO @tableList (value) VALUES (@value) END SET @list = RIGHT(@list, LEN(@list) + 1 - LEN(@delimiter) - @position) SET @position = CHARINDEX(@delimiter, @list, 1) END END RETURN END GO
2007-10-02 (first published: 2002-06-20)
15,403 reads
I have always read that 8060 bytes is the maximum size. This is stated over and over again in Books Online, the MS site and numerous other sites, including this one. However a post in our forum recently questioned this. I decided to verify the problem and do a little research.
2007-10-02 (first published: 2002-02-07)
37,051 reads
The User_Defined_Functions.exe file contains the User-Defined Functions white paper. The User-Defined functions white paper outlines the characteristics of the new user-defined function (UDF) feature that is introduced in Microsoft SQL Server 2000. The white paper also summarizes how you can create your own Transact-SQL functions to extend the programmability of Transact-SQL.
The following stored procedure will demonstrate the use of cursor metadata. Using cursor metadata we can get information about an SQL statement and use that information to dynamically generate other code such as HTML or other stored procedures.
2001-07-27
5,061 reads
ne of the issues you face when building Web applications is handling the errors you encounter when interacting with a back-end database. I was recently working with someone to create a new Web site with SQL Server™, ActiveX® Data Objects (ADO), and ASP. Lots of little things came up that I thought were worth sharing with MIND readers, so I'll focus this column on what I learned from this experience and the solutions to many of the problems I faced.
2001-07-13
1,579 reads