ALTER PROCEDURE dbo.dingpiaoinsert
(
@userId uniqueidentifier,
@Str nvarchar(200),
@movie_yingtingid int,
@date datetime
)
AS
begin
begin try
DECLARE @Index int;
DECLARE @Left nvarchar(50);
WHILE CHARINDEX('|',@Str) > 0
BEGIN
SELECT @Index = CHARINDEX('|',@Str);
SELECT @Left = LEFT(@Str,@Index-1);
INSERT INTO Seat_User(UserId,SeatId,Movie_yingtingid,[date]) VALUES (@userId,@Left,@movie_yingtingid,@date);
SELECT @Str = REPLACE(@Str,@Left+'|','');
END
IF @Str <> ''
BEGIN
INSERT INTO Seat_User(UserId,SeatId,Movie_yingtingid,[date]) VALUES (@userId,@Left,@movie_yingtingid,@date);
END
return 0
end try
begin catch
return error_number()
end catch
end