Hi...
In my appllication, i am having a DataTable... For that DataTable i have to write a query for a expression... This epression is more of mathematical expression type. Here is the sample expression-
(column1 < 1 && (column2 = 2 || column3 > 5) || column4 != 3)
How i can write a query for such a equation...? Is it possible to use logical & mathematical operator in the equation & to write a query for this type of equation... Is there is any good article on this...
Thanks in adavnce...
IamHuM
What exactly you need here. You can use the logical/math opertor as per your requirement.
Pls provide more clarity on your requirement.
|||A good place to start is referring to Books Online, Topic 'Operators [Transact SQL]'.
Unfortunately, T-SQL does NOT have a full and rich set of mathematical operators. Depending upon your needs, you may be better served by exploring the capabilities of creating custom CLR functions (using VB.NET/C#.NET) and then having your SQL code use those CLR functions. A place to start with that is, again, Books Online, Topic: 'CLR User Defined Functions'.
As Mani indicated, if you post a more in-depth description of your requirements, we may be better able to guide you to the best resources.
|||
Code Snippet
select *
from
where Column1 < 1
and
(
(Column2 = 2 OR Column3 > 5)
OR
(Column4 <> 3)
)
Which is functionally equivalent to:
Code Snippet
select *
from <TableName>
where Column1 < 1
and
(
Column2 = 2
OR Column3 > 5
OR Column4 <> 3
)