谁能帮我把下面的 MS-SQL sp 写到 MySQL sp,
使用这个:
CREATE PROCEDURE sp_InputWork
@_DelimitedString nvarchar(MAX)
AS
BEGIN
SET NOCOUNT ON;
DECLARE @_DataRow nvarchar(MAX)
DECLARE @_DescriptionOfWorkDone nvarchar(MAX)
DECLARE @_TemporaryStorage nvarchar(MAX)
DECLARE @_QTY int
DECLARE @_Total int
DECLARE @_CurrentField int
WHILE CHARINDEX(';', @_DelimitedString) > 0
BEGIN
SET @_DataRow = CAST(SUBSTRING(@_DelimitedString, 0, CHARINDEX(';', @_DelimitedString)) AS nvarchar(MAX))
SET @_CurrentField = 1
WHILE CHARINDEX(',', @_DataRow) > 0
BEGIN
SET @_TemporaryStorage = CAST(SUBSTRING(@_DataRow, 0, CHARINDEX(',', @_DataRow)) AS nvarchar(MAX))
IF @_CurrentField = 1
SET @_QTY = CAST(@_TemporaryStorage AS int)
IF @_CurrentField = 2
SET @_DescriptionOfWorkDone = @_TemporaryStorage
IF @_CurrentField = 3
SET @_Total = CAST(@_TemporaryStorage AS int)
SET @_DataRow = SUBSTRING(@_DataRow, CHARINDEX(',', @_DataRow) + 1, LEN(@_DataRow))
SET @_CurrentField = @_CurrentField + 1
END
INSERT INTO tblWorkDone (QTY, DescriptionOfWorkDone, Total) VALUES (@_QTY, @_DescriptionOfWorkDone, @_Total)
SET @_DelimitedString = SUBSTRING(@_DelimitedString, CHARINDEX(';', @_DelimitedString) + 1, LEN(@_DelimitedString))
END
END