I'm running a web app in C# .NET and am trying to backfill my query by re-querying the DB if it returns less than three results. This is probably not a hard one but I don't know where to begin.
Lisa, if you don't like your job you don't strike. You just go in every day and do it really half-assed. That's the American way. - Homer Simpson
[small]<P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <.</B> bites again.[/small]
If you're running a stored procedure , you could do as part of your stored procedure:
SET NOCOUNT ON;
declare @cnt INT
SET @cnt = (SELECT COUNT (*) FROM myTable )
IF @cnt > 3
BEGIN
SELECT COUNT (*) FROM myTable
END
ELSE
<whatever the second sql statement would be>
END
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.