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 |
sureshprabhu
Starting Member
32 Posts |
Posted - 2007-11-07 : 02:15:18
|
hi!i have one datatable with some file's details like id, name, createdate. i wrote one storedprocedure to search in that table by filename using wildcard character. its also working perfectly. But the problem is i want to arrange the results in ascending order depended by matching level. If I search for 'file123' it should give results in one order by matching level, means - lets think the results are 'fil23', file123', 'file', 'file1'. the results should be in order like 'file123', 'fil23', 'file1', 'file'. the results of the sp which i used, are order by datecreated. Please help me to do this.the storeprocedure i used -"CREATE PROCEDURE [dbo].[SP_DYN_SearchinFiles_DynByWildcardsADMIN] @searchparam nvarchar(50)ASBEGIN select Id, OriginalName, ContentType, FullName, Department, DateCreated, Client, usernamefrom Files_Dyn where PATINDEX('%' + @SearchParam + '%', OriginalName) > 0END" |
|
Kristen
Test
22859 Posts |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-11-07 : 03:53:44
|
You didnt use any order by clause. Use order by filenameMadhivananFailing to plan is Planning to fail |
 |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-11-07 : 03:55:39
|
where OriginalName LIKE '%' + @SearchParam + '%'might be a better choice E 12°55'05.25"N 56°04'39.16" |
 |
|
sureshprabhu
Starting Member
32 Posts |
Posted - 2007-11-07 : 04:02:12
|
Thanks Peso, my problem solved. |
 |
|
sureshprabhu
Starting Member
32 Posts |
Posted - 2007-11-07 : 04:03:06
|
And also thanks to Kristen and Madhivanan for your response. |
 |
|
|
|
|
|
|