title: Assert parameters in a table-valued UDF
body: <p>Is there a way to create "asserts" on the parameters of a table-valued UDF. </p>
  
  <p>I'd like to use a table-valued UDF for performance reasons, however I know that certain parameter combinations (like start and end dates that are more than a month apart) will cause performance issues on the server for all users.</p>
  
  <p>End users query the database via Excel using UDFs.  UDFs (and table-valued UDFs in particular) are useful when the data is too large for Excel.  Users write simple SQL queries that categorizes the data into groups to reduce the number of rows. For example, the user may be interested in weekly aggregates rather than hourly ones.  Users write a group by SELECT statement to reduce the rows by 24x7=168 times. I know I can write RAISERROR statements in multistatement UDFs, but table-valued UDFs are integrated in the query optimizer so these queries are more efficient with table-valued UDFs.</p>
  
  <p>So, can I define assertions on the parameters passed to a table-valued UDF?</p>