I would use an inline table valued user defined function. Or simply code it inline is no re-use is required CREATE dbo. GetSuitableCategories ( --parameters ) RETURNS TABLE AS RETURN ( select * from categoryTable categories where categories.
Gender IN (3, @gender) ) Some points though: I assume categoryTable has no gender = 0 Do you have 3 genders in your categoryTable? :-) Why do pass in 3 parameters but only use 1? See below please Does @sex map to @gender?
If you have extra processing on the 3 parameters, then you'll need a multi statement table valued fucntions but beware these can be slow.
You can't use the results of a stored procedure directly in a select statement You'll either have to output the results into a temp table, or make the sproc into a table valued function to do what you doing. I think this is valid, but I'm doing this from memory create table #tmp (blah, blah) Insert into #tmp exec dbo.sprocName.
You could also create a view that returns the data you are requesting if all the GetSuitableCategories SP does is run a Select statement. – b_richardson May 16 '10 at 5:57.
I have a temperature measurements stored in a table, each measure have actuall date/time BUT logically the measure day runs from noon-noon (and not midnight-modnight). Measure done at 09/18/2011 13:00:00 already belongs to 09/19/2011 "measure day". Is there a simple way to have the same query to support both scenarios?
Ideally I want to have a function that get @from/@to as parameters and returns the result as table. Below is a full example you can run.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.