I have a store procedure where I pass a path to the file like:
EXEC spMyPathFile
@PFile = 'C:\TFiles\Paths\Test_1.1_Version.txt'
What I'd like to do it loop through and be able to pass a number of versions of the file like 1.1 and 1.2 etc using:
DECLARE @intLp INT
DECLARE @a varchar(2)
SET @intLp = 1 WHILE (@intLp <2)
BEGIN IF @intLp = 1 BEGIN
SET @a = '1.1'
END
ELSE IF @intLp = 2
BEGIN
SET @a = '1.2'
END
EXEC spMyPathFile
@PFile = 'C:\TFiles\Paths\Test_'+@a+'_Version.txt'
SET @intLp = @intLp + 1
END
For some reason I get "Incorrect syntax near '+'." which is just before the @a. I'm obviously not joining my variable to my string properly.
Could someone give me an example of how this should look?