Home Forums SQL Server 2012 SQL Server 2012 - T-SQL If I understand Views VS Functions correctly...I should use views to enapsulated commonly used where clauses? RE: If I understand Views VS Functions correctly...I should use views to enapsulated commonly used where clauses?

  • Phillip.Putzback (5/2/2014)


    Maybe I should simplify it. Let's say you need to report on Midwest states in many reports, ETLS, or stored procedures... Would it not be easier to have a vie for Midwest states than typing out a list of states in an in list function for all those objects that would need to filter to Midwest states.

    How would you define the "Midwest states"? What happens if that definition changes? What happen when you want something more flexible?

    Views might do the work now, but flexibility is something you should appreciate.

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2