473,396 Members | 1,724 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Strange issue in execution of sql

2
Hello Everyone,

I have a encountered a strange issue with the execution of my stored procedure on clients machine.

My stored procedure contains a cursor in which there is a select statement written in concatinated string format (provided below).

when i execute the procedure on my clients database some concatinated
lines in the select statement are not considered.(i.e the select statement is executed without those two line between the query and this results in error).

Please find the below Actual string query in the procedure.

SELECT @sqlA = ' SELECT DISTINCT d.Dossierid, w.WorkFlowNo FileNo, CONVERT(VARCHAR,w.OpenedDate,103) [Date], '
+ ' p.Name Client, t.name [Trade], s.name [Services], '
+ ' qs.QuotedIncome Estimated_Income, '
+ ' qs.QuotedExpense Estimated_Expense, '
+ ' ISNULL((SELECT SUM(ISNULL(i.InvoiceIncome,0)) FROM IRISARCHIVE.dbo.InvoiceSummary i WHERE i.Dossierid = d.DossierId),0)+ ISNULL(IRISARCHIVE.dbo.GetDRCRAmtLocal_JC_WithoutV AT(d.DossierID),0) as Actual_Income,'
+ ' IRISARCHIVE.dbo.GetActualAmount_WithoutVAT(d.Dossi erID) as Actual_Expense, FileCloseYN '
+ ' FROM IRISARCHIVE.dbo.QuoteSummary qs, IRISARCHIVE.dbo.WorkFlow w, IRISARCHIVE.dbo.Party p, IRISARCHIVE.dbo.ProfitCenter pc, IRISARCHIVE.dbo.Service s, IRISARCHIVE.dbo.Trade t, '
+ ' IRISARCHIVE.dbo.Dossier d '
+ ' LEFT JOIN IRISARCHIVE.dbo.InvoiceSummary i ON d.DossierID = i.DossierID '
+ ' WHERE qs.DossierID = w.DossierID '
+ ' and d.DossierID = qs.DossierID '
+ ' and d.ClientID = p.PartyID '
+ ' and d.ServiceID = s.ServiceID '
+ ' and d.TradeID = t.TradeID '
+ ' and s.ProfitCenterID = pc.ProfitCenterID '

but when this query is executed in the cursor on client side it does not have the below two line in it.

+ ' IRISARCHIVE.dbo.Dossier d '
+ ' LEFT JOIN IRISARCHIVE.dbo.InvoiceSummary i ON d.DossierID = i.DossierID '

and what runs inside the cursor at client side is this

SELECT DISTINCT d.Dossierid, w.WorkFlowNo FileNo,
CONVERT(VARCHAR,w.OpenedDate,103) [Date], p.Name Client,
t.name [Trade], s.name [Services], qs.QuotedIncome Estimated_Income,
qs.QuotedExpense Estimated_Expense, ISNULL((SELECT SUM(ISNULL(i.InvoiceIncome,0))
FROM IRISARCHIVE.dbo.InvoiceSummary i
WHERE i.Dossierid = d.DossierId),0)+ ISNULL(IRISARCHIVE.dbo.GetDRCRAmtLocal_JC_WithoutV AT(d.DossierID),0) as Actual_Income,
IRISARCHIVE.dbo.GetActualAmount_WithoutVAT(d.Dossi erID) as Actual_Expense, FileCloseYN
FROM IRISARCHIVE.dbo.QuoteSummary qs, IRISARCHIVE.dbo.WorkFlow w, IRISARCHIVE.dbo.Party p,
IRISARCHIVE.dbo.ProfitCenter pc, IRISARCHIVE.dbo.Service s, IRISARCHIVE.dbo.Trade t, --lines missing over here..
WHERE qs.DossierID = w.DossierID and d.DossierID = qs.DossierID and d.ClientID = p.PartyID
and d.ServiceID = s.ServiceID and d.TradeID = t.TradeID and s.ProfitCenterID = pc.ProfitCenterID
and d.FileCloseYN=-1 and w.WorkFlowNo like '' and d.ClientId =0 and d.TradeId =0 and d.ServiceId =0
and CONVERT(VARCHAR,CONVERT(DATETIME,w.OpenedDate,03), 112) between 20080401 and 20080408

Well this is not the issue at our end as when we run the same cursor all whole select statement get executed and there is no error and the report is displayed........but this issue is on the client side....is there some kind of sql or database settings that i am missing which is causing this...because we have the same database at our development side and we find no issue at out end......

Please help this issue is killing me............
Jul 18 '08 #1
3 1514
amitpatel66
2,367 Expert 2GB
The below line looks big..can you break this and add as a seperate statement?

+ ' FROM IRISARCHIVE.dbo.QuoteSummary qs, IRISARCHIVE.dbo.WorkFlow w, IRISARCHIVE.dbo.Party p, IRISARCHIVE.dbo.ProfitCenter pc, IRISARCHIVE.dbo.Service s, IRISARCHIVE.dbo.Trade t, '

something like this:

+ ' FROM IRISARCHIVE.dbo.QuoteSummary qs,'
+ 'IRISARCHIVE.dbo.WorkFlow w,'
+ 'IRISARCHIVE.dbo.Party p, IRISARCHIVE.dbo.ProfitCenter pc,'
+ 'IRISARCHIVE.dbo.Service s, IRISARCHIVE.dbo.Trade t, '
Jul 18 '08 #2
Vish4u
2
I have tried what u suggested...but still it fails.

Its ridiculous as i m not getting any help for such an issue.

I have tried google but have never came across such an issue.

The query works ok at our end but ignores two line when executed at client side,,,,

Please help me..............
Jul 24 '08 #3
ck9663
2,878 Expert 2GB
Check the your variable size and total length of the query. What's the max your variable can handle? What's the max string on your app?

-- CK
Jul 24 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Ethel Aardvark | last post by:
I am running a 9.0.1 database on a W2K server and have come across some strange behaviour with a SQL query. I have a query which runs in a PL/SQL cursor which has several PL/SQL variables used to...
2
by: Mahesh Hardikar | last post by:
Hi , Oracle EE 8.1.7.0.0 on MS WIndows Advanced Server 2000 SP3 We have a proc which is using utl_file . procedure test_dump_csv as l_rows number; begin
5
by: MGB | last post by:
I have a strange performance question hopefully someone can clarify for me. I take a production database and make a copy of it, called test, on the same instance on the same server both running at...
24
by: LineVoltageHalogen | last post by:
Greetings All, I was hoping that someone out there has run into this issue before and can shed some light on it for me. I have a stored procedure that essentially does a mini ETL from a source...
2
by: Neil | last post by:
I have a strange situation. I have a stored procedure that is hanging upon execution, but only some machines and not others. The db is an Access 2000 MDB using ODBC linked tables and a SQL 7 back...
1
by: Default | last post by:
Hi, I am new to C#, that is why I am not sure what kind of problem it is: Is VS files corrupted , or something else. that is the problems description: I am working on a small database project. I am...
2
by: Diffident | last post by:
Hello All, I am trying to redirect users to a standby webpage in case our application is down due to database server failure. To facilitate this I am opening a test connection within a try/catch...
4
by: Praveen_db2 | last post by:
Hi All I am getting strange errors in my db2diag.log can any one tell me what these errors mean?? Following is the code from my db2diag.log...
1
by: Victor | last post by:
Hi guys, I have a very strange problem with scriptmanager here. I want to load a js (which is embed in the project) but everytime i try to load that, it gives me error like Specified argument was...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.