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 |
|
taylo
Yak Posting Veteran
82 Posts |
Posted - 2000-12-06 : 20:49:13
|
| Here is a tough one. My T-SQL script will ORDER BY whateverfield the user is searching by. Most of my fields are nvarchar but a couple are numeric. Birthday and Sponsor in the Case statementare genrating errors as they are both numeric. Does anyoneknow what the syntax would be for converting @searchcrit to a numeric date type? That way I can use it to validate thefirst 4 fields then change it's data type and validate the last 2.CREATE PROCEDURE SP_Search @groopeid numeric(10),@searchcrit nvarchar(50)ASSelect FirstName,LastName,SiteMembers.Email,Birthday,City,ClassYear,Joined from GroopeMembers INNER JOIN SiteMembers on SiteMembers.ParentNumber =GroopeMembers.UserID Where Groope = @groopeid ORDER BY CASE @searchcrit When 'FirstName' then FirstName When 'LastName' then LastName When 'SiteMembers.Email' then SiteMembers.Email When 'City' then City When 'Birthday' then Birthday <--numeric When 'Sponsor' then Sponsor <-- numeric else LastName EndThanks,Rob |
|
|
|
|
|