Quantcast
Viewing all articles
Browse latest Browse all 5

Robust Parameters

I'm not sure what you mean when you wrote: "how do I get each statement to represent a value in the paramaeter list".

Based on your original post you query may look like

select 'anonymous' as fullname, f.comments
from feedback as f, contact_view as c
where c.name_id = F.name_id
and C.fullname like ('ZZ.%')  AND (@parameter = 'anonymous' OR @parameter = 'all')

UNION

select C.fullname, f.comments
from feedback as f, contact_view as c
where c.name_id = F.name_id
and C.fullname not like ('ZZ.%') AND (@parameter = 'named' OR @parameter = 'all')

If you want to give a select statement an alias then you can use common table expressions (CTE).

http://www.4guysfromrolla.com/webtech/071906-1.shtml

 

 

 


Remember to mark as an answer if this post has helped you.

Viewing all articles
Browse latest Browse all 5

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>