Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

OpenQuery Select statement Help!!

Status
Not open for further replies.

bmann

Programmer
Oct 8, 2002
128
0
0
US
I want to use an Openquery using the below select Statement. Also would openquery be faster than the below select statement. LAcalphoto is a linked server.


select * FROM LAcalphoto.DOJviews.dbo.DOB
where timestamp > (select timestamp from Los_Angeles_CALPHOTO.dbo.TIMESTAMPTABLE)
 
Open query would be slower than a linked server.

I suspect that the reason your query is slow is because of the sub query. If you can show some sample data from both tables, and expected results, we can probably help re-write the query so that it is faster.

Hint: Only show the relevant columns in your sample data, and change necessary data to protect the innocent.

-George
Microsoft SQL Server MVP
My Blogs
SQLCop
"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
Hello gmmastros. Here is some sample data below. all I am trying to do is pull records from a large recordset by selecting all records in the DOB table with timestamp > timestamp field from the TIMESTAMPTABLE.

select * FROM LAcalphoto.DOJviews.dbo.DOB
where timestamp > (select timestamp from Los_Angeles_CALPHOTO.dbo.TIMESTAMPTABLE)

DOB Table

FCN Timestamp
10 2/4/2011
11 1/5/2011

Timestamptable

Timestamp
2/3/2011
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top