Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Snitz Forums 2000 MOD-Group
 MOD Add-On Forum (W/Code)
 Search.asp case sensitive on sql server
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

Machina
New Member

Switzerland
74 Posts

Posted - 22 June 2004 :  07:11:26  Show Profile  Visit Machina's Homepage
Hi all,

the sql server is case sensitive in my company. This was a problem when I was searching in the forum. I worked on that and finally had to change some code AND DATA STRUCTURE in the tables.

Now my search is no more case sensitive with this sql server

If you have any comment, please tell me.

1/Data Structure
It is a very bad idea to have used in FORUM_TOPICS and FORUM_REPLY a data type ntext for the fields T_MESSAGE and R_MESSAGE

I changed these 2 fields to be in VARCHAR, 6000 caracters

2/ Code Changes in search.asp

I added the UPPER and UCASE to make everything not case sensitive.

From line 224 to 251 :

'################# New Search Code #################################################
if Request.Form("SearchMessage") = 1 then
if strAndOr = "phrase" then
strSql3 = strSql3 & " (UPPER(T.T_SUBJECT) LIKE '%" & Ucase(ChkString(Request.Form("Search"), "SQLString")) & "%') "
else
For Each word in keywords
SearchWord = ChkString(word, "SQLString")
strSql3 = strSql3 & " (UPPER(T.T_SUBJECT) LIKE '%" & Ucase(SearchWord) & "%') "
if cnt < keycnt then strSql3 = strSql3 & strAndOr
cnt = cnt + 1
next
end if
else
if strAndOr = "phrase" then
strSql3 = strSql3 & " (UPPER(R.R_MESSAGE) LIKE '%" & Ucase(ChkString(Request.Form("Search"), "SQLString")) & "%'"
strSql3 = strSql3 & " OR UPPER(T.T_SUBJECT) LIKE '%" & Ucase(ChkString(Request.Form("Search"), "SQLString")) & "%'"
strSql3 = strSql3 & " OR UPPER(T.T_MESSAGE) LIKE '%" & Ucase(ChkString(Request.Form("Search"), "SQLString")) & "%') "
else
For Each word in keywords
SearchWord = ChkString(word, "SQLString")
strSql3 = strSql3 & " ((UPPER(R.R_MESSAGE) LIKE '%" & Ucase(SearchWord) & "%')"
strSql3 = strSql3 & " OR (UPPER(T.T_SUBJECT) LIKE '%" & Ucase(SearchWord) & "%')"
strSql3 = strSql3 & " OR (UPPER(T.T_MESSAGE) LIKE '%" & Ucase(SearchWord) & "%')) "
if cnt < keycnt then strSql3 = strSql3 & strAndOr
cnt = cnt + 1
next
end if
'################# New Search Code #################################################

Machina
-------
http://www.jaboulay.fr
--------
Snitz based site:
http://www.itu.int/YLinICTs
MODS Used : TMPJ's Header Cell Image, Site Integration, Front Page News, News Events Calendar, Nikkol's Usergroups, Simple Slash, Avatar, File Sharing, Links

HuwR
Forum Admin

United Kingdom
20584 Posts

Posted - 22 June 2004 :  07:55:56  Show Profile  Visit HuwR's Homepage
quote:
1/Data Structure
It is a very bad idea to have used in FORUM_TOPICS and FORUM_REPLY a data type ntext for the fields T_MESSAGE and R_MESSAGE

I changed these 2 fields to be in VARCHAR, 6000 caracters


There is nothing wrong with defining them as ntext and it is not a BAD idea either, they are ntext for a reason, you have now imposed a 6000 char limit on your posts, we have not set any limit hence the ntext.


Go to Top of Page

Machina
New Member

Switzerland
74 Posts

Posted - 22 June 2004 :  10:57:33  Show Profile  Visit Machina's Homepage
Yes I know,but the sql server I work on is case sensitive. This means that any search was hugely limited... I didn't find any other idea on this. ntext is good for it huge amount of data, but how many times will it happen for a post to contain more than 6000 caracters?

Machina
-------
http://www.jaboulay.fr
--------
Snitz based site:
http://www.itu.int/YLinICTs
MODS Used : TMPJ's Header Cell Image, Site Integration, Front Page News, News Events Calendar, Nikkol's Usergroups, Simple Slash, Avatar, File Sharing, Links

Edited by - Machina on 22 June 2004 10:57:50
Go to Top of Page

HuwR
Forum Admin

United Kingdom
20584 Posts

Posted - 22 June 2004 :  13:36:58  Show Profile  Visit HuwR's Homepage
more often than you think.

Go to Top of Page

sr_erick
Senior Member

USA
1318 Posts

Posted - 22 June 2004 :  14:58:03  Show Profile  Visit sr_erick's Homepage  Send sr_erick a Yahoo! Message
Your original post was very close to 2000 characters alone. It really doesn't take much to go over 6000 characters.




Erick
Snowmobile Fanatics

Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.21 seconds. Powered By: Snitz Forums 2000 Version 3.4.07