Showing posts with label bcol1. Show all posts
Showing posts with label bcol1. Show all posts

Monday, March 19, 2012

Can There be a single Index

Can we make a Index on 2 or more tables

Table a:
Col1 int
col2 varchar

Table b:
Col1 int
col2 varchar

can you have a single index for two tables a and b on the column Col1.
Is this possible in SQL-Server.

As far as i know you can make an index only on one Table.

can the index be shared by two tables?
index y which is created is shared by
table a , table b and table c

I like the idea of a union an putting it in a veiw and having a index
but i dont want to make 100 views for a special index.

first of all i want to know wether the index is only on one table can be
on multiple tables.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!vinay bhushan <bhushanvinay@.mail.com> wrote in message news:<409b0dac$0$204$75868355@.news.frii.net>...
> Can we make a Index on 2 or more tables
> Table a:
> Col1 int
> col2 varchar
> Table b:
> Col1 int
> col2 varchar
> can you have a single index for two tables a and b on the column Col1.
> Is this possible in SQL-Server.
> As far as i know you can make an index only on one Table.
> can the index be shared by two tables?
> index y which is created is shared by
> table a , table b and table c
> I like the idea of a union an putting it in a veiw and having a index
> but i dont want to make 100 views for a special index.
> first of all i want to know wether the index is only on one table can be
> on multiple tables.
>
> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!

No - an index exists on one table (or indexed view) only. If you have
a specific indexing problem, then you could post more details and
someone may be able to suggest a solution.

Simon|||vinay bhushan (bhushanvinay@.mail.com) writes:
> Can we make a Index on 2 or more tables
> Table a:
> Col1 int
> col2 varchar
> Table b:
> Col1 int
> col2 varchar
> can you have a single index for two tables a and b on the column Col1.
> Is this possible in SQL-Server.

By means of an indexed view, yes.

What an indexed means in practice is that you materialize the view,
so it still really one table under the covers. But you don't have
the chores to keep it updated. SQL Server takes care of that for you.

--
Erland Sommarskog, SQL Server MVP, sommar@.algonet.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp|||Is your question because of a particular problem? Are you getting a
performance issue joining the two table together?

Alicia

http://www.sqlporn.co.uk :o)