MrsMope987
Programmer
- Sep 27, 2007
- 23
Hello,
I've read the FAQ on this site for the Split function, I want to take a field that has 13 different values delimited by a semi-colon. These values are for each month and one for adjustments. I need to have this split out as such:
How do I do this? I was trying to use:
But I don't know how to reference the field correctly because I keep getting an error saying
I've read the FAQ on this site for the Split function, I want to take a field that has 13 different values delimited by a semi-colon. These values are for each month and one for adjustments. I need to have this split out as such:
Code:
Field Currently:
RowID Title
3 MANAGEMENT INCENTIVE EXP
PeriodAmt
1500;1500;1500;1500;7500;1500;1500;1500;0;0;0;0;0
[RED]I need:
RowID Title Jan Feb Mar Apr May June etc.
3 Management 1500 1500 1500 1500 7500 1500 etc.
[/red]
How do I do this? I was trying to use:
Code:
DECLARE @PeriodAmt Varchar(20)
SET @PeriodAmt = PeriodAmt
SELECT RowID, PeriodAmt
FROM GL09Data G
INNER JOIN dbo.Split(@PeriodAmt,';') S
ON G.RowID = S.Value -- Implicit conversion to int
ORDER BY S.TokenID
But I don't know how to reference the field correctly because I keep getting an error saying
Code:
[red]Msg 207, Level 16, State 1, Line 2
Invalid column name 'PeriodAmt'.[/red]