EXEMPLO_1212310
Database
Tables
(current)
Columns
Constraints
Relationships
Orphan Tables
Anomalies
Routines
SPLIT
Parameters
Name
Type
Mode
@DELIMITER
varchar
IN
@LIST
varchar
IN
Definition
--UpgUpgradeServer CREATE FUNCTION SPLIT ( @DELIMITER VARCHAR(5), @LIST VARCHAR(MAX) ) RETURNS @TABLEOFVALUES TABLE ( ROWID SMALLINT IDENTITY(1,1), [VALUE] VARCHAR(MAX) ) AS BEGIN DECLARE @LENSTRING INT WHILE LEN( @LIST ) > 0 BEGIN SELECT @LENSTRING = ( CASE CHARINDEX( @DELIMITER, @LIST ) WHEN 0 THEN LEN( @LIST ) ELSE ( CHARINDEX( @DELIMITER, @LIST ) -1 ) END ) INSERT INTO @TABLEOFVALUES SELECT SUBSTRING( @LIST, 1, @LENSTRING ) SELECT @LIST = ( CASE ( LEN( @LIST ) - @LENSTRING ) WHEN 0 THEN '' ELSE RIGHT( @LIST, LEN( @LIST ) - @LENSTRING - 1 ) END ) END RETURN END