Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
WestWind/database filter help
Message
From
30/06/2011 16:42:44
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01516279
Message ID:
01516930
Views:
48
The SP is usually used for running reports and those parameters get entered in VS Reporting. I thought that may have something to do with it, maybe I'll just copy the SP and not use any of those parameters and see if that works.

>This SP seems to expect @ShippedLo and @ShippedHi parameters. What are the parameters for the SP and verify that this is what you're passing.
>
>>I can't get the Profiler working because I'm getting the SP from the same server that is actively being used, so there are tons of hits being recorded and I don't even see mine going through.
>>
>>As for the SP itself, here it is:
>>
>>
DECLARE @ClientCode char(3)
>>	DECLARE @ClientName varchar(50)
>>	DECLARE @date varchar(10)
>>	SET @ClientCode = (SELECT ClientCode FROM TBLMaster.dbo.[User] WHERE UserLogin = @ReportUser)
>>	SET @ClientName = (SELECT ClientName FROM TBLMaster.dbo.Client WHERE ClientCode = @ClientCode)
>>	SET @date = '20110330'
>>
>>SELECT	bol_number, u.ref_num, pro_number, client_zip, client_city, customer_name, customer_state, tb.carrier_name, bol_status, p.delivered_date, customer_zip, ship_date, p.weight, io, p.date_last_updated, convert(date,curr_est_deliver_date,101) as [est_delivery], convert(date,appt_date,101) as [appt_date],
>>
>>CASE WHEN ISNULL(p.delivered_date, tb.delivered_date) IS NOT NULL OR force_delivered = 1 OR (SELECT TOP 1 ISNULL(status_code, appt_status_code) FROM tbl_214_status a LEFT JOIN tbl_214_isa b ON b.tbl_214_id = a.tbl_214_id WHERE bol_id = tb.bol_id ORDER BY isa_09 DESC, isa_10 DESC, status_date DESC, status_time DESC, a.record_num DESC) = 'D1' THEN (SELECT sd_display FROM edi_status_descriptions WHERE edi_status_code = 'D1') 
>>ELSE (SELECT TOP 1 ISNULL(sd_display, asd_display) FROM tbl_214_status a LEFT JOIN edi_status_descriptions b ON b.edi_status_code = a.status_code LEFT JOIN edi_appt_status_descriptions c ON c.edi_appt_status_code = a.appt_status_code LEFT JOIN tbl_214_isa d ON d.tbl_214_id = a.tbl_214_id WHERE bol_id = tb.bol_id ORDER BY isa_09 DESC, isa_10 DESC, status_date DESC, status_time DESC, a.record_num DESC) END as [Latest Status Description],
>>
>>CASE WHEN ISNULL(p.delivered_date, tb.delivered_date) IS NOT NULL OR force_delivered = 1 OR (SELECT TOP 1 ISNULL(status_code, appt_status_code) FROM tbl_214_status a LEFT JOIN tbl_214_isa b ON b.tbl_214_id = a.tbl_214_id WHERE bol_id = tb.bol_id ORDER BY isa_09 DESC, isa_10 DESC, status_date DESC, status_time DESC, a.record_num DESC) = 'D1' THEN (SELECT srd_display FROM edi_status_reason_descriptions WHERE edi_status_reason_code = 'NS') 
>>ELSE (SELECT TOP 1 ISNULL(srd_display, ard_display) FROM tbl_214_status a LEFT JOIN edi_status_reason_descriptions b ON b.edi_status_reason_code = a.status_reason_code LEFT JOIN edi_appt_reason_descriptions c on c.edi_appt_reason_code = a.appt_reason_code LEFT JOIN tbl_214_isa d ON d.tbl_214_id = a.tbl_214_id WHERE bol_id = tb.bol_id ORDER BY isa_09 DESC, isa_10 DESC, status_date DESC, status_time DESC, a.record_num DESC) END as [Latest Reason Description]
>>
>>FROM    tbl_bol tb
>>		LEFT JOIN 	dbo.tbl_ref_nums u	on 	tb.bol_id = u.bol_id
>>		INNER JOIN dbo.tbl_214_datatable p on tb.bol_id = p.bol_id
>>		INNER JOIN tbl_carrier c ON c.scac_code = p.scac
>>		INNER JOIN tbl_carrier_access a ON a.carrier_id = c.carrier_id AND a.dba_id = tb.dba_id
>>
>>	
>>WHERE  (client_name LIKE 'sfs%') and ship_date >= @ShippedLo and ship_date <= @ShippedHi and ship_date > edi_start_date
>>--AND     ISNULL(p.delivered_date, tb.delivered_date) IS NULL 
>>AND 	force_delivered = 0 
>>AND     ((SELECT TOP 1
>>		ISNULL(status_code, appt_status_code) 
>>		FROM 	tbl_214_status a 
>>		LEFT JOIN tbl_214_isa b 	ON 	b.tbl_214_id = a.tbl_214_id 
>>		WHERE 	bol_id = tb.bol_id and ship_date >= @ShippedLo and ship_date <= @ShippedHi
>>		ORDER BY isa_09 DESC, isa_10 DESC, status_date DESC, status_time DESC, a.record_num DESC) <> 'D1' 
>>		OR
>>		(SELECT COUNT(*) 	
>>		FROM 	tbl_214_status 
>>		WHERE 	bol_id 	= tb.bol_id) = 0) and ship_date >= @ShippedLo and ship_date <= @ShippedHi and bol_number <> '04000012008079191'
>>END
Previous
Reply
Map
View

Click here to load this message in the networking platform