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 |
|
dnagahawatte
Starting Member
24 Posts |
Posted - 2004-06-22 : 11:17:27
|
| Hi GuysI m trying to pass a parameter to the below Store ProcedureCREATE PROCEDURE [Sp_ConfigureCourses]@Colleague_cartNumber varchar(50) ASSelect * FROM CarterCourses WHERE @Colleague_cartNumber <>1 order by CourseNameGOAs you can see here @Colleague_cartNumber is the column NameWhat datatype should i pass the parameter as.If i pass as int or nvarchar i get errors.(asp.net application)Please help |
|
|
raymondpeacock
Constraint Violating Yak Guru
367 Posts |
Posted - 2004-06-22 : 11:28:52
|
| The datatype of the parameter isn't the problem here. The parameter isn't being resolved at execution to evaluate to the column name. You could try dynamic SQL something like thisDECLARE @cmd VARCHAR(1000)SET @cmd = 'SELECT * FROM CarterCourses WHERE ' + @Colleague_CartNumber + ' <> 1 ORDER BY CourseName'EXEC (@cmd)Raymond |
 |
|
|
dnagahawatte
Starting Member
24 Posts |
Posted - 2004-06-22 : 11:56:17
|
| sweetThanks a lot for the quick reply... |
 |
|
|
|
|
|