Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2005-03-21 : 08:25:24
|
| Satishkumar writes "Dear Team,I am using the Crosstab procedure for converting the rows into columns and so on.In the following syntax,EXECUTE crosstab SELECT statement, summary calculation, pivot column, table name The first parameter does not allow put single quotes, brackets if there is any where clause in it. I have appended below my query, EXECUTE crosstab 'SELECT tblLearnerGeneral.LearnerDivisionId FROM tblLearnerGeneral INNER JOINtblLearnerResourcestatus ON (tblLearnerGeneral.Learnerid=tblLearnerResourceStatus.Learnerid)where tblLearnerResourcestatus.certificationstatusID='certified'and tblLearnerGeneral.LearnerDivisionID is not NULLGROUP BY tblLearnerGeneral.LearnerDivisionId', 'avg(Learnerid)', 'ResourceName','tblLearnerResourcestatus'Please help me out.Regards,Satishkumar Mamidala" |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2005-03-21 : 20:34:30
|
| All you have to do is double the quote marks within the statement:EXECUTE crosstab 'SELECT tblLearnerGeneral.LearnerDivisionId FROM tblLearnerGeneral INNER JOINtblLearnerResourcestatus ON (tblLearnerGeneral.Learnerid=tblLearnerResourceStatus.Learnerid)where tblLearnerResourcestatus.certificationstatusID=''certified''and tblLearnerGeneral.LearnerDivisionID is not NULLGROUP BY tblLearnerGeneral.LearnerDivisionId', 'avg(Learnerid)', 'ResourceName','tblLearnerResourcestatus'Note, those are two consecutive single-quote marks, NOT one double-quote mark. |
 |
|
|
|
|
|
|
|