SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 check for index existance from another db
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

subhaoviya
Posting Yak Master

India
135 Posts

Posted - 10/03/2012 :  10:19:11  Show Profile  Reply with Quote
Hi,

I am forming queries in DB1 and for one of my query i need to acces the table of DB2. to make the performance faster i just need to create an index on searching column of that target table of DB2.

while i am trying to check for indexes on that particular table i am getting error like
The multi-part identifier "DB1.dbo.Table" could not be bound.

the query that i tried

USE DB1
select * from SYS.indexes where object_id=object_id(DB1.dbo.table)

thanks
subha

visakh16
Very Important crosS Applying yaK Herder

India
52317 Posts

Posted - 10/03/2012 :  10:20:56  Show Profile  Reply with Quote
are the DBs in the same server?. you could try

USE [DB1]
GO
select * from SYS.indexes where object_name(object_id)='table'


------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

subhaoviya
Posting Yak Master

India
135 Posts

Posted - 10/03/2012 :  10:22:29  Show Profile  Reply with Quote
yes both dbs are in same server
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52317 Posts

Posted - 10/03/2012 :  10:28:37  Show Profile  Reply with Quote
try last posted query as well

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000