Showing posts with label employees. Show all posts
Showing posts with label employees. Show all posts

Monday, February 20, 2012

Please help, my query is hanging the server and preventing others from updating the table

Hi,
I'm having a big problem.,
if I issue the following query:
SELECT Customers.*, Employees.*
FROM Customers INNER JOIN
Employees ON Customers.EmployeeID =
Employees.EmployeeID
Then while this query is running all other users are unable to make any
Updates to the Customer Table. If I remove the join and only query the
customer table then other users are able to update the customer table
while this query is running.. The problem is that I need to do a join
so that I can pull some data from the employee table that corresponds to
data within the customer table. Is there a way around this?
Thanks,
In addition to Tibor's advise, do not use '*' in production . Do you realy
need all columns from both tables?
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in
message news:eGCLi0FdIHA.4144@.TK2MSFTNGP05.phx.gbl...
> Do you have indexes to support the join? I.e. an index on
> Customers.EmployeeID and one on Employees.EmployeeID.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://sqlblog.com/blogs/tibor_karaszi
>
> "RobDob" <jsmith20042005@.yahoo.com> wrote in message
> news:16689F4712774D569058EC91B8FDC70B@.rkstriglPC.. .
>
|||"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:eJO0caHdIHA.4712@.TK2MSFTNGP04.phx.gbl...
> In addition to Tibor's advise, do not use '*' in production . Do you
> realy need all columns from both tables?
>
And to add what Uri asked, do you really need to return ALL rows?

>
> "Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote
> in message news:eGCLi0FdIHA.4144@.TK2MSFTNGP05.phx.gbl...
>
Greg Moore
SQL Server DBA Consulting Remote and Onsite available!
Email: sql (at) greenms.com http://www.greenms.com/sqlserver.html