CREATE PROCEDURE dbo.spTEMPtable1
(
@columnData5 nvarchar(500),
@columnData19 nvarchar(500)
)
AS
BEGIN
SET NOCOUNT ON
DECLARE @data5 datetime
DECLARE @data19 datetime
DECLARE @PosColumn5 int
DECLARE @PosColumn19 int
SET @columnData5 = LTRIM(RTRIM(@columnData5))+,
SET @columnData19 = LTRIM(RTRIM(@columnData19))+,
SET @PosColumn5 = CHARINDEX(,, @columnData5, 1)
SET @PosColumn19 = CHARINDEX(,, @columnData19, 1)
IF REPLACE(@columnData5, ,,) <>
BEGIN
WHILE @PosColumn5 > 0
BEGIN
SET @data5 = LTRIM(RTRIM(LEFT(@columnData5, @PosColumn5 - 1)))
SET @data19 = LTRIM(RTRIM(LEFT(@columnData19, @PosColumn19 - 1)))
IF @data5 <>
BEGIN
--SET @data5 =12/12/2005
SET @data19 =01/01/2005
-- Select @data5 = convert(datetime, @tempData5)
-- SET @data5 = CAST(@tempData5 as datetime(8))
INSERT INTO TEMPtable1
VALUES (Cast(@data5 as datetime), @data19)
END
SET @columnData5 = RIGHT(@columnData5, LEN(@columnData5) - @PosColumn5)
SET @columnData19 = RIGHT(@columnData19, LEN(@columnData19) - @PosColumn19)
SET @PosColumn5 = CHARINDEX(,, @columnData5, 1)
SET @PosColumn19 = CHARINDEX(,, @columnData19, 1)
END
END
END
GO