labtech
Database
Tables
(current)
Columns
Constraints
Relationships
Orphan Tables
Anomalies
Routines
sp_split
Parameters
Name
Type
Mode
toSplit
text
IN
outputTable
varchar(50)
IN
Definition
BEGIN SET @sql := CONCAT('DROP TABLE IF EXISTS ', outputTable); PREPARE stmt FROM @sql; EXECUTE stmt; DEALLOCATE PREPARE stmt; SET @sql := CONCAT('CREATE TEMPORARY TABLE ', outputTable, ' (`variable` VARCHAR(1000))'); PREPARE stmt FROM @sql; EXECUTE stmt; DEALLOCATE PREPARE stmt; SET @vars := toSplit; SET @vars := CONCAT("('", REPLACE(@vars, ",", "'),('"), "')"); SET @sql := CONCAT('INSERT INTO ', outputTable, ' VALUES ', @vars); PREPARE stmt FROM @sql; EXECUTE stmt; DEALLOCATE PREPARE stmt; END