Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with FAQ183-5278

Status
Not open for further replies.

oyam

Programmer
Jan 17, 2001
9
US
I copied this incredible crosstab procedure, but for some reason, I get bunch of errors trying to create. I am sure I am doing something wrong. Thanks. Osher

Here are the errors received:

Server: Msg 170, Level 15, State 1, Procedure spCrossTabRun, Line 50
Line 50: Incorrect syntax near ','.
Server: Msg 156, Level 15, State 1, Procedure spCrossTabRun, Line 118
Incorrect syntax near the keyword 'execute'.
Server: Msg 156, Level 15, State 1, Procedure spCrossTabRun, Line 120
Incorrect syntax near the keyword 'insert'.
Server: Msg 137, Level 15, State 1, Procedure spCrossTabRun, Line 147
Must declare the variable '@Cnt'.
Server: Msg 137, Level 15, State 1, Procedure spCrossTabRun, Line 147
Must declare the variable '@AllParameters'.
Server: Msg 137, Level 15, State 1, Procedure spCrossTabRun, Line 148
Must declare the variable '@Cnt'.
Server: Msg 137, Level 15, State 1, Procedure spCrossTabRun, Line 149
Must declare the variable '@AllParameters'.
Server: Msg 137, Level 15, State 1, Procedure spCrossTabRun, Line 150
Must declare the variable '@Cnt'.
Server: Msg 137, Level 15, State 1, Procedure spCrossTabRun, Line 150
Must declare the variable '@ParseParam'.
Server: Msg 137, Level 15, State 1, Procedure spCrossTabRun, Line 151
Must declare the variable '@End'.
Server: Msg 156, Level 15, State 1, Procedure spCrossTabRun, Line 157
Incorrect syntax near the keyword 'ELSE'.
Server: Msg 170, Level 15, State 1, Procedure spCrossTabRun, Line 213
Line 213: Incorrect syntax near '='.
Server: Msg 156, Level 15, State 1, Procedure spCrossTabRun, Line 216
Incorrect syntax near the keyword 'ORDER'.
 
There are four syntax errors - all about odd number of quotes (one missing) - in lines 50, 157, 213 and 215.

Paste this code into QA and see where it goes red. This indicates unclosed string.

I'm pretty sure donutman wouldn't leave such a mess... so this may be TT-related problem. Feel free to report it.

------
"There's a man... He's bald and wears a short-sleeved shirt, and somehow he's very important to me. I think his name is Homer."
(Jack O'Neill, Stargate)
[banghead]
 
I'm not pretending to understand this, but I've got a copy, and pay attention to the number of single quotes in this part:

[tt]SELECT @SqlCase=Coalesce(@SqlCase,'') +', [' + IsNull(Convert(varchar(8000), PivotColumn),'NULLS') + '] = ' +
@BeforeAgg+Stuff(@AggregateFunction,CharIndex( '(', @AggregateFunction )+1, 0, 'CASE ' + @PivotColumn + ' WHEN '
+ @Delimiter + IsNull(Replace(Convert(varchar(8000), PivotColumn),'''',''''''),'NULL') + @Delimiter + ' THEN ' )
FROM (SELECT DISTINCT TOP 100 PERCENT PivotColumn FROM ##CrossTab ORDER BY PivotColumn) DistinctPiv[/tt]

Roy-Vidar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top