Using LIKE within CASE in TSQL

I would like to select the records that contain the content of the @selctDescription parameter but only when @selctDescription is not empty.

I have the following, which does not work:

(t.[description] LIKE 
  WHEN @selctDescription = '' THEN t.[description] 
  ELSE ('%' @selctDescription '%') 

Can anyone point me in the right direction?


FROM Table
  ((@selctDescription IS NULL OR @selctDescription = '') 
   (t.[description] LIKE '%' + @selctDescription +'%'))

Need Your Help

Why does C++ Boost distribution have `.dll`and `.lib` files?

c++ boost dll

Howdi folks. I'm currently in the process of creating a "shared" library (aka DLL on windows) which in turn would rely on "Boost C++" libraries for date time features. I have noticed that my Boost

Fiddler Reissue and Edit and Reissue from composer

keyboard-shortcuts fiddler

I'm using Fiddler on daily life. However, the most used feature for me, such as Reissue and Edit and Reissue from composer don't have any shortcuts. I don't know how to use fiddler script for this....

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.