Re: Views for denomalizing

From: Anith Sen <anith_at_bizdatasolutions.com>
Date: Thu, 03 Feb 2005 06:57:57 GMT
Message-ID: <VXjMd.5243$cl1.3811_at_newsread3.news.pas.earthlink.net>


>> The only normal form that cannot be breached when creating SQL92 views is
>> the same one required for base tables -- 1NF.

Nope. SQL tables, *technically* cannot have a repeating group, since columns in a SQL table can have only scalar values. However that does not mean that all are in 1NF. Duplicates, column ordering, NULLs etc. all cause violation of 1NF. ( In practice, SQL user often try to fake/simulate list-like structures using existing types though )

Your question regarding UDFs seems more apt for the product specific forum.

>> I recall that SQL Server UDF's permit lists to be returned, ...

That is incorrect. SQL Server UDFs are either scalar or table-valued. And a table valued UDF is more or less similar to a parameterized view. Its return value is a table; in other words a table valued UDF returns a set of rows each with a set of columns each with a valid t-SQL datatype. However, they may violate 1NF due to reasons mentioned before.

>> Do SQL Server customers create views that include these user defined
>> functions (returning derived data values) with lists of values?

Not with "lists of values", but with a t-SQL table valued UDF, yes.

>> If so, how does SQL handle queries against such views? If not, what
>> prohibits this?

It would behave the same way as any nested SQL expression would behave. However, not all t-SQL operations are allowed within a table valued UDF -- the product manual should have the details on which constructs/expressions are allowed.

-- 
Anith 
Received on Thu Feb 03 2005 - 07:57:57 CET

Original text of this message