Let say you want to create a on-the-fly table which fetch the list of users with certain properties. The problem with the users is that, some of them is without any properties. Instead of displaying blank, you want to display ‘—-‘. Since you want to do this on the fly, not by modifying the table. These infos will come handy.

Simply using UNION will help you to achieve above problem. Meta-SQL :

Select User,Properties
From Users where Properties <> Null
Union
Select User, '----' as Properties
From users
where User not in
(Select User from Users where Properties <> Null)

In IIS, this will throw you Collation error if you Users table is encoded in UTF8, the Properties value of ‘—-‘ will be encoded in Latin. Thus, it will throws you collation error.

In order to convert the ‘—-‘ encoded as UTF8, you must use _utf8 as prefix of your string. Eq: _utf8′—-‘ instead of only ‘—-‘

No Comment

Your Comment

Search The Web

SODEVE Search

Selamat Datang!

All postings/content on this blog are provided "AS IS" with no warranties, and confer
no rights. All entries in this blog are my opinion and do not necessarily reflect
the opinion of my employer or sponsors.