本文介绍了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---

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".

推荐答案

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


另请注意,在AcademicYear=''2010''


Also note that you had an extra semeicolon after AcademicYear=''2010''


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


这篇关于SQL中的表值参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-11 15:32