We help IT Professionals succeed at work.
Get Started

MS SQL Linked Server using Open Query causing catastrophic failure

sfletcher1959
on
1,433 Views
Last Modified: 2015-12-04
Here is my query:
Select AQ.hwt_user, AQ.Cust_Div_Def_Definit,
AQ.hwt_action, AQ.hwt_entity_id,
AQ.Order_H_PO, AQ.FirstName + ' ' + AQ.LastName as UserName,
AQ.hwt_part_number, AQ.hwt_location_id_wasp,
AQ.hwt_asset_tag, AQ.hwt_serial_number,
AQ.hwt_quantity, AQ.hwt_create_date,
AQ.hwt_create_time, AQ.hwt_entry_date,
AQ.hwt_entry_time, AQ.hwt_processed,
AQ.Prod_Description, location.code as location_code
From
OPENQUERY(CommPlete,
'Select hh_warehouse_trans.hwt_user, Customer_Division_De.Cust_Div_Def_Definit,
hh_warehouse_trans.hwt_action, hh_warehouse_trans.hwt_entity_id,
Order_Header.Order_H_PO,
Rtrim(User_Code_Table.User_First_Name) as FirstName, Rtrim(User_Code_Table.User_Last_Name) as LastName,
hh_warehouse_trans.hwt_part_number, hh_warehouse_trans.hwt_location_id_wasp,
hh_warehouse_trans.hwt_asset_tag, hh_warehouse_trans.hwt_serial_number,
hh_warehouse_trans.hwt_quantity, hh_warehouse_trans.hwt_create_date,
hh_warehouse_trans.hwt_create_time, hh_warehouse_trans.hwt_entry_date,
hh_warehouse_trans.hwt_entry_time, hh_warehouse_trans.hwt_processed,
Product_Catalog.Prod_Description
From hh_warehouse_trans
Inner Join Customer_Division_De
On Customer_Division_De.Cust_Div_Def_Custome = ''2009010101''
And Customer_Division_De.Cust_Div_Def_Divisio = hh_warehouse_trans.hwt_warehouse
Inner Join Product_Catalog
On Product_Catalog.Prod_Customer_No = ''2009010101''
And Product_Catalog.Prod_Customer_Div = hh_warehouse_trans.hwt_warehouse
And Product_Catalog.Prod_Mfr_Part_No = hh_warehouse_trans.hwt_part_number
Left Outer Join Order_Header
On Order_Header.Order_H_Order_No = hh_warehouse_trans.hwt_entity_id
Inner Join User_Code_Table
On User_Code_Table.User_ID = hh_warehouse_trans.hwt_user
Where hh_warehouse_trans.hwt_asset_tag = ''AM00163779''
And hh_warehouse_trans.hwt_action <> ''Move''
And hh_warehouse_trans.hwt_processed = 1
') As AQ Left Outer Join
location On location.location_id = AQ.hwt_location_id_wasp
Order By AQ.hwt_entry_date Desc,
AQ.hwt_entry_time Desc

This works on an older 2003 sp2 server running MS SQL 2005 but fails with a catastrophic failure on a 2012 R2 server running MS SQL 2012.
Comment
Watch Question
Professional Troublemaker^h^h^h^h^hshooter
CERTIFIED EXPERT
Commented:
This problem has been solved!
Unlock 2 Answers and 21 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE