|
Posted by Erland Sommarskog on 12/06/05 00:27
(paulmac106@gmail.com) writes:
> I tried a computed column, but then all the users of the windows
> application that is the front end of this database got errors when
> trying to insert a record into this table. Is there anything more I
> have to do to use a computed column?
Sounds like a case of poor application design.
An alternative is to use an indexed view instead. The view would look
like:
CREATE VIEW showed_view WITH SCHEMABINDING AS
SELECT pkcol
FROM tbl
WHERE yourcolumn = 'Showed'
You would then have to use this view in your queries. (In theory SQL Server
could use the view even if you query the table directly, but it does not
always happen.)
--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
Navigation:
[Reply to this message]
|