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?

  • I'd define the Midwest states by whatever the company defined them as. Let's say I was a franchise and I was limited so a certain area. Say Indiana, Ohio and Kentucky. I would think it would be better to set that standard in one view so all reports didn't have to recreate it. Then if someday I needed to add Illinois I would only have to change it in my vMidwestRegion and all reports, procedures.. would pick it up and not require a search for dependencies. I'm just wondering if that is the typical practice. Because currently i have to republish Stored procedures every time a customer decides they are missing some data or have too much and they throw another code that needs to be excluded\included. So the any referenced procedure gets changed in the test environment then pushed into Prod. Now we do have some report writers that use functions like the common split-list function that takes a list of values and parses it to create a table. But from what I am reading here it is probably better to join a view than a function that returns a table.