home
about
contact
examples
subscribe
loads of useful information, examples and tutorials pertaining to web development utilizing asp.net, c#, vb, css, xhtml, javascript, sql, xml, ajax and everything else...
Search
categories
ajax (16)
asp.net (77)
c# (96)
css (15)
design (7)
entities (17)
excel (8)
html (12)
iis (1)
javascript (15)
jquery (18)
links (6)
linq (22)
linq-to-sql (14)
mvc (12)
my projects (22)
other (8)
sharepoint (12)
sql (17)
steal some code (70)
tutorials (31)
vb (1)
vb script (4)
visual studio (4)
xml (9)
Advertise Here
<< Using a Custom Controller Class in Asp.Net MVC to Simplify Coding
|
Helper Methods for Validating Generated Linq-to-Entities edmx Files using Partial Classes >>
Ternary Operator in SQL
by
naspinski
2/3/2012 1:32:00 PM
there technically isn't one, but an equivalent isn't too hard to do
This ternary in C#:
(str.Length > 0 ? "yes" : "no");
Is equivalent to this in SQL:
(CASE WHEN LEN(@str) > 0 THEN "yes" ELSE "no" END);
Tags:
sql
sql
Related posts
An error occured: System.Data.SqlClient.SqlException: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible.
One simple solution to this error I often face
Running C# libraries with the SQL CLR
You can run your dlls from inside SQL - but it is a bit limited
Ternary operators simplified
Making sense of mysterious ternary operator
Comments are closed