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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 like syntax

Author  Topic 

PeterG
Posting Yak Master

156 Posts

Posted - 2003-05-22 : 18:47:28
On my web page I have alphabet links and an "Others" link. When you click any of the alphabet links, a query to search by that alphabet is done - syntax: select ... where Fieldname like 'A%'. Now what about the syntax for the "Others" link? It should be a search for records that start with characters other than an alphabet. It could be numeric, a comma, etc. (maybe exclude the SQL server reserved characters).

nr
SQLTeam MVY

12543 Posts

Posted - 2003-05-22 : 18:52:35
you can do

where field like '[^a-zA-Z]%'

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

PeterG
Posting Yak Master

156 Posts

Posted - 2003-05-22 : 18:56:34
I knew this one from regular expression, but I didn't think I couldn't use reg exp in sql.

Anyways, thanks nr.

Go to Top of Page

Arnold Fribble
Yak-finder General

1961 Posts

Posted - 2003-05-23 : 04:15:40
quote:

I didn't think I couldn't use reg exp in sql.


LIKE uses the regexp character range syntax, but no, it doesn't support proper regexps.
But see this thread: http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=24386


Go to Top of Page

SamC
White Water Yakist

3467 Posts

Posted - 2003-05-23 : 09:10:58

It's good to know that there is a regular expression DLL for SQL. Has anyone at SQLTEAM had experience using it?

Sam

Go to Top of Page
   

- Advertisement -