You are here: Re: Setting up a store procedure... « MsSQL Server « IT news, forums, messages
Re: Setting up a store procedure...

Posted by Anith Sen on 12/20/07 19:19

Not sure how involved this requirement is. If you want to get the list of
alphabets from the existing titles, you can have simple query like:

SELECT DISTINCT LEFT( titles, 1 ) AS "alpha"
FROM tbl
ORDER BY "alpha" ;

In many cases, for fast searching and indexing, people implement other
alternatives. One variation is to have another table that is referenced back
to the titles table. Another one with smaller list could be a computed
column that is indexed with the expression: LEFT( titles, 1 ) etc.

If you want all the alphabets displayed regardless of existing titles, you
can easily generate them on the client side itself. Most web development
tools have build in functions that does this in a quick loop. If you want to
do this with t-SQL, you can use the CHAR() function on a simple query like:

SELECT CHAR( n )
FROM Nbrs
WHERE n BETWEEN 65 AND 90 ;

Regarding how the table Nbrs is created, see:
www.projectdmx.com/tsql/tblnumbers.aspx

--
Anith

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация