0

Can someone please show me how to use a Searched CASE expression inside of the select method of a datatable? I keep getting the error:

Syntax error: Missing operand after 'WHEN' operator

This is what I'm trying and it's not working with the error above.

DataRow[] unMappedRows = matches.Select("(CASE WHEN TRUE THEN 1 END) = 1");

I'm using SQL Server 2008 R2 and .NET Framework 4.

4

1 に答える 1

0

さて..あなたが試みている検索されたCASE式はフィルターではありません...

http://msdn.microsoft.com/en-us/library/det4aw50%28v=vs.100%29.aspx

それによると、あなたが提供したリンクと一緒に、あなたはこのようなことを試みています(t-sql擬似コードで)

select *
from  table
where (case when true then 1 end) = 1

これは許可されていません。

それが役に立てば幸い

于 2013-02-27T20:20:03.773 に答える