Viewing 15 posts - 1 through 15 (of 22 total)
i split my query into ~4K pieces and assigned each piece to a variable. Then i assigned them to one, and executed it.
SET @DynamicPivotQuery = @part1 + @part2 + @part3...
March 13, 2015 at 7:46 am
Your GamesWon definition gives these errors:
Msg 207, Level 16, State 1, Line 15
Invalid column name 'LeagueName'.
Msg 207, Level 16, State 1, Line 16
Invalid column name 'ShortName'.
Msg 207, Level 16, State...
March 13, 2015 at 6:59 am
Unfortunately I am not able to post data or DDL since it is proprietary. I just thought there might be a known problem with dynamic SQL and appending variables, such...
March 12, 2015 at 5:25 pm
The values are all hard-coded because that is the only way I can it to run for now. The point of the PIVOTS are to eventually replace the hard-coded values...
March 12, 2015 at 12:36 pm
Without the variable it gives me the correct results.
http://citydynasty.com/Opponent/Baseball/MLB/2012-Opponent3.cshtml
March 12, 2015 at 12:19 pm
The variable is "@ColumnName2".
I want to use it in the PIVOT statements so they can be run against any divisions without hard coding them as they are now (where you...
March 12, 2015 at 12:17 pm
The errors I get when I use the variable are here. I don't get any errors when I remove the variable.
Msg 102, Level 15, State 1, Line 67
Incorrect syntax near...
March 12, 2015 at 11:38 am
Here is the SQL. If I replace the line 'SUM(ALWins) FOR Division_Name IN (['+@ColumnName2 +'])' with 'SUM(ALWins) FOR Division_Name IN ([East],[Central],[West])' it works correctly. The code is actually a...
March 12, 2015 at 11:36 am
I know it is being truncated because I get a syntax error at a point about a third of the way in my SQL which I don't get if I...
March 12, 2015 at 9:05 am
I think I have it working now:
WITH GamesWon AS(
SELECT Lge,
GameDate,
HomeTeam...
November 12, 2014 at 4:28 pm
I created this query:
WITH GamesWon AS(
SELECT Lge,
GameDate,
HomeTeam Team,
...
November 12, 2014 at 2:10 pm
The results from your query are:
Lge Team TotalwinsGamesBehind
LeagueATeamB4.0 ...
November 12, 2014 at 1:32 pm
Thank you for your reply.
Your query works but it only uses wins for the calculation.
In this example:
WLGB
B410
A253
The "games behind" are found by subtracting Team A wins from Team B plus...
November 12, 2014 at 12:52 pm
Viewing 15 posts - 1 through 15 (of 22 total)