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 |
Gokila
Starting Member
2 Posts |
Posted - 2011-05-27 : 02:30:12
|
This is my code it shows some error likeMsg 137, Level 15, State 2, Procedure Sp_ReportStudContacts, Line 28Must declare the scalar variable "@Hostler".set ANSI_NULLS ONset QUOTED_IDENTIFIER ONGOALTER PROC [dbo].[Sp_ReportStudContacts](@ClassID bigint,@SectionID bigint,@StudType varchar(50))AsSELECT CM.ClassName, SM.SectionName, SD.StudentCode, SD.StudentName, SD.PresentAddress, SD.PermenantAddress, SD.PhoneNo, SD.Hostler, SD.ClassID, SD.SectionID, SD.StudentIDFROM StudentDetails SD INNER JOIN ClassMaster CM ON SD.ClassID=CM.ClassID INNER JOIN SectionMaster SM ON SD.SectionID=SM.SectionIDWHERE (SD.ClassID=@ClassID) AND (SD.SectionID=@SectionID) AND (CONVERT(VARCHAR(50),SD.Hostler)=CONVERT(VARCHAR(50),@Hostler))--EXEC Sp_ReportStudContacts @ClassID='1',@SectionID='1'Please Help meR.Gokila |
|
nigelrivett
Master Smack Fu Yak Hacker
3385 Posts |
Posted - 2011-05-27 : 02:58:53
|
Self explanatory.@Hostler is not definedI'm guessing it needs to be a parameter and passed to the SP.You're not passing @Stud in the call either or using it - maybe that should be @Hostler.I suspect there is no need for the convert statements there - and the brackets ae just confusing things.==========================================Cursors are useful if you don't know sql.SSIS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
|
|
|
|