Hi everyone,
Having serious problem trying to make a variable change.
this is in a loop
Set @versionSection = '@version'+@iCount
so theoratically @versionSection will be changed to eg. @version1 ????
Query is below the stars.
TA in advance
***********************************************************
CREATE PROCEDURE sp1_Insert
(
@iErrorCode int OUTPUT,
@number varchar(50),
@title varchar(300),
--@implementationdate datetime,
@implementationtype varchar(50),
@status bit,
@version1 decimal(9),
@version2 decimal(9),
@version3 decimal(9),
@version4 decimal(9),
@version5 decimal(9),
@version6 decimal(9),
@version7 decimal(9),
@version8 decimal(9),
@version9 decimal(9),
@version10 decimal(9),
@version11 decimal(9),
@version12 decimal(9),
@version13 decimal(9),
@version14 decimal(9),
@version15 decimal(9),
@version16 decimal(9),
@version17 decimal(9),
@version18 decimal(9),
@version19 decimal(9),
@version20 decimal(9),
@version21 decimal(9),
@version22 decimal(9),
@version23 decimal(9),
@version24 decimal(9),
@version25 decimal(9),
@version26 decimal(9),
@version27 decimal(9)
--@version28 decimal(9)
)
AS
-- ** -- ** -- ** -- ** -- ** -- ** -- ** -- ** -- ** -- ** -- ** --
INSERT into modification
( number,
title,
--implementationdate,
implementationtype,
status
)
VALUES
( @number,
@title,
--@implementationdate,
@implementationtype,
@status
)
-- ** -- ** -- ** -- ** -- ** -- ** -- ** -- ** -- ** -- ** -- ** --
Declare @iCount int, @modificationID int, @versionSection varchar(15)
Set @iCount = 1
Set @modificationID = @@IDENTITY
EXEC sp1_modification_section_addmodification @modification_id_1 = @modificationID
WHILE @iCount < 28
BEGIN
Set @versionSection = '@version'+@iCount
INSERT into modification_section_lnk
( modification_id,
section_id,
version
)
VALUES
( @modificationID,
@iCount,
@versionSection
)
print @iCount
set @iCount = @iCount + 1
END
-- ** -- ** -- ** -- ** -- ** -- ** -- ** -- ** -- ** -- ** -- ** --
SELECT @iErrorCode=@@ERROR
GO
Having serious problem trying to make a variable change.
this is in a loop
Set @versionSection = '@version'+@iCount
so theoratically @versionSection will be changed to eg. @version1 ????
Query is below the stars.
TA in advance
***********************************************************
CREATE PROCEDURE sp1_Insert
(
@iErrorCode int OUTPUT,
@number varchar(50),
@title varchar(300),
--@implementationdate datetime,
@implementationtype varchar(50),
@status bit,
@version1 decimal(9),
@version2 decimal(9),
@version3 decimal(9),
@version4 decimal(9),
@version5 decimal(9),
@version6 decimal(9),
@version7 decimal(9),
@version8 decimal(9),
@version9 decimal(9),
@version10 decimal(9),
@version11 decimal(9),
@version12 decimal(9),
@version13 decimal(9),
@version14 decimal(9),
@version15 decimal(9),
@version16 decimal(9),
@version17 decimal(9),
@version18 decimal(9),
@version19 decimal(9),
@version20 decimal(9),
@version21 decimal(9),
@version22 decimal(9),
@version23 decimal(9),
@version24 decimal(9),
@version25 decimal(9),
@version26 decimal(9),
@version27 decimal(9)
--@version28 decimal(9)
)
AS
-- ** -- ** -- ** -- ** -- ** -- ** -- ** -- ** -- ** -- ** -- ** --
INSERT into modification
( number,
title,
--implementationdate,
implementationtype,
status
)
VALUES
( @number,
@title,
--@implementationdate,
@implementationtype,
@status
)
-- ** -- ** -- ** -- ** -- ** -- ** -- ** -- ** -- ** -- ** -- ** --
Declare @iCount int, @modificationID int, @versionSection varchar(15)
Set @iCount = 1
Set @modificationID = @@IDENTITY
EXEC sp1_modification_section_addmodification @modification_id_1 = @modificationID
WHILE @iCount < 28
BEGIN
Set @versionSection = '@version'+@iCount
INSERT into modification_section_lnk
( modification_id,
section_id,
version
)
VALUES
( @modificationID,
@iCount,
@versionSection
)
print @iCount
set @iCount = @iCount + 1
END
-- ** -- ** -- ** -- ** -- ** -- ** -- ** -- ** -- ** -- ** -- ** --
SELECT @iErrorCode=@@ERROR
GO