InIn order to convert a coldfusion query to a stored procedure I've implemented the following code given to me in an earlier post.
SELECT Column1
From Table
WHERE Column2 = 0
<cfif someVar = 3>
AND Column3=0
</cfif>
becomes..........
SELECT Column1
From Table
WHERE Column2 = 0
And (
(@SomeVar = 3 And Column3 = 0)
Or IsNull(@SomeVar, 0) <> 3
)
However, my query has now got more complicated
It runs as follows
SELECT Column1
From Table
WHERE Column2 = 0
<cfif someVar = 3>
AND Column3=30
<cfelseif anotherVar=4>
AND Column4=40
<cfelse>
<cfif yetanothervar=5>
AND column5=50
</cfif>
</cfif>
How could I implement this as a stored procedure ?
Thanks for your help in advance...I know it's a tough one !
SELECT Column1
From Table
WHERE Column2 = 0
<cfif someVar = 3>
AND Column3=0
</cfif>
becomes..........
SELECT Column1
From Table
WHERE Column2 = 0
And (
(@SomeVar = 3 And Column3 = 0)
Or IsNull(@SomeVar, 0) <> 3
)
However, my query has now got more complicated
It runs as follows
SELECT Column1
From Table
WHERE Column2 = 0
<cfif someVar = 3>
AND Column3=30
<cfelseif anotherVar=4>
AND Column4=40
<cfelse>
<cfif yetanothervar=5>
AND column5=50
</cfif>
</cfif>
How could I implement this as a stored procedure ?
Thanks for your help in advance...I know it's a tough one !