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

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 t-sql 2008 performance issue
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Constraint Violating Yak Guru

332 Posts

Posted - 09/14/2013 :  17:43:00  Show Profile  Reply with Quote
I am having a performnace problem is a sql server 2008 sql. The stored procedure does a full table scan when one of the @state
or @zip paramteres are used. The dba says he will not put an index on the state and zip columns since this is the only sql that uses state and zip cocde. The sql look like the following:

select cs.person_id,cs.cust_id,cs.customer_name,cs.address1, cs.address2,, cs.cuct_id,z.product_name,z.product_description
from customer_table cs left join view1 v1 on v1.cust_id = cs.cust_id
left join
(select product_id,product_name,product_description from product_table p on p.iventory_id = v.iventory_id
where @prod_quantity <= p.supply_on_hand) z on z.person_id = c.person_id where @zip = or @state=cs.state

Thus can you tell me what I can do to make this sql run faster?
  Previous Topic Topic Next 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.02 seconds. Powered By: Snitz Forums 2000