本文介绍了使用Union时如何声明的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我要Union的语句:

this are the statements that i want to Union:

Create PROCEDURE[dbo].[spUnion3]
(
@RigionID int)
AS SELECT     Schools.SchoolName
FROM         SchoolDistrict, Schools
WHERE     SchoolDistrict.SchoolDistrictID = Schools.DistrictID AND SchoolDistrict.RegionID = @RegionID

UNION

SELECT     ECD.ECDName
FROM         SchoolDistrict, ECD
WHERE     SchoolDistrict.SchoolDistrictID = ECD.DistrictID AND SchoolDistrict.RegionID = @RegionID


但这给了我这个错误信息:


But it gives me this error massage:

"Must declare the scalar variable "@RegionID".".

请帮助.

尝试作为storedprosedure这样做,它给了我同样的错误,但是在第二个区域中,参数

Please help.

tried to doing it as storedprosedure it gives me the same error but on the 2nd Region Parameter

推荐答案



这篇关于使用Union时如何声明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-28 11:05