0

I am trying to create a simple function (or possible a stored procedure) that returns a list of values.

For example:

select title
from title
where tittle not in ('sample1','sample2',etc...)

so the results of this query will be:

title1
title2
title3

etc

I want to use this function over and over again in several other queries I have written, am just trying to avoid writing the long query which takes time and is tedious.

Not sure whether a stored procedure is best or function. and not sure which type of function is best (table?)

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
  • Not really clear on what you're asking... are you asking if you should use a table valued function or an SP, or are you asking about how to accomplish the other thing which doesn't have enough info provided to be of assistance? See http://stackoverflow.com/questions/178128/functions-vs-stored-procedures for a comparison of functions vs stored procedures – Kritner Sep 04 '14 at 15:36
  • Yes i would like to know whats best a SP or table valued function. But i was reading that i cannot use SP in a select statement. I want to use this function in a select statement ... for example I am trying to create a simple function (or possible a stored procedure) that returns a list of values. For example: select title from title where tittle not in (exec function) again the function is going to return a list of values (one column) – user2654626 Sep 04 '14 at 16:04
  • 1
    It sounds like you already have your answer then :P – Kritner Sep 04 '14 at 16:05

0 Answers0