Click here to Skip to main content
15,893,266 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
SQL
Create TYPE PassType as table (Grade int,TotoP int)
Declare @Pass PassType
insert @Pass Select Grade, COUNT(ProgressionStatus)
             from LearnerProgression
             where AcademicYear='2010'; and EmisCode='500171421'
             group by Grade



got this piece of code but it gives me an error---

SQL
Msg 2715, Level 16, State 3, Line 6
Column, parameter, or variable #1: Cannot find data type PassType.
Parameter or variable '@Pass' has an invalid data type.
Msg 1087, Level 16, State 1, Line 3
Must declare the table variable "@Pass".
Posted
Updated 8-Sep-11 6:26am
v2

You don't need to create a type, just define the variable as a table:
SQL
Declare @Pass as table (Grade int,TotoP int)
insert @Pass Select Grade, COUNT(ProgressionStatus)
             from LearnerProgression
             where AcademicYear='2010' and EmisCode='500171421'
             group by Grade

Also note that you had an extra semeicolon after AcademicYear='2010'
 
Share this answer
 
Comments
Mehdi Gholam 8-Sep-11 12:36pm    
Smart, 5!
Wendelius 8-Sep-11 14:37pm    
Thank you Mehdi.
try the following :
SQL
Create TYPE PassType as table (Grade int,TotoP int)
GO
Declare @Pass PassType
insert @Pass Select Grade, COUNT(ProgressionStatus)
             from LearnerProgression
             where AcademicYear='2010' and EmisCode='500171421'
             group by Grade
 
Share this answer
 
v2
Comments
Wendelius 8-Sep-11 14:38pm    
This would also work fine, my 5.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900