Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 view/table from multiple tables; pivotted

Author  Topic 

BorisCallens
Yak Posting Veteran

50 Posts

Posted - 2008-07-24 : 03:40:52
Hi,

For a search function I use a custom search table that goes as follows:

id bigint identity(1,1)
value varchar(50)
source varchar(50)
colorId int

This table gets filled from several other tables with the values I can search on from those tables, the source of that value (table.field) and the id of the entry in the main (color) table so I can link the found value back to the color later.

Search is lightning fast and powerfull now, but the table is static and takes a lot of space.
Is it possible to make something like this in a view? Are there better ways to do the same?

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-07-24 : 03:58:16
A view is not normally not materialized, so that will not help you.



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

BorisCallens
Yak Posting Veteran

50 Posts

Posted - 2008-07-24 : 04:08:35
If I understand this [url]http://www.sqlteam.com/article/indexed-views-in-sql-server-2000[/url] and other resources correctly, I could index the view and then it would become materialized, not?

But I could settle for a table as well.
Only thing is I then have to manually update it, where a view is maintained by sql server.
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-07-24 : 04:13:20
You can write one or more triggers to maintain the table for you.
It will be difficult for me to suggest something more practical without knowing more about your application.


E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

BorisCallens
Yak Posting Veteran

50 Posts

Posted - 2008-07-24 : 04:20:56
Since this table is the pivotted agregate of about 10 tables, it would require a bunch of triggers.
But it is an option.

Thanks
Go to Top of Page
   

- Advertisement -