|
I'll state upfront that I don't understand why it behaves as you describe and thus cannot really offer anything towards fixing the bug, if there is one. But I do think you can work around the problem by using multiple threads instead of asynchronous processes. By creating a worker thread (using the BackgroundWorker is an easy way to accomplish this - it uses an event-driven model with a DoWork event, allowing you to simply write the handler and it will then run on the background thread, and will notify you when the thread stops running) your application can avoid freezing and report progress as the procedure executes.
|
|
|
|
|
By the way, multiple threads are of course used with your current technique, and perhaps you do not need any async flag in your connection string - could be worth trying at least.
We make fairly heavy use of background threads to execute long-running queries in our product, though we create the threads explicitly and have implemented a polling system that makes it easy to run any code in the background and poll a business object for information. We have to use a polling model because it's a web application, ie. a client-server solution, and with this in place the reusable bit takes care of thread management (including queueing), generating polls from the client and performing a callback to a client-side function so we can update the user interface on the fly. We've had lots of bugs of course but they've always been logical and due to errors we made in our code, not the result of any quirks or bugs elsewhere.
|
|
|
|
|
As I said above, the call to EXECUTE PROCESS executes a number of other stored procedures. All of them, like the root procedure, have SET NOCOUNT ON as the first line of code and SET NOCOUNT OFF as the last line of code. Removing these two lines from the sub procedures fixed the problem.
As best we can figure out, the scope of the NOCOUNT flag is global to the original procedure and not to the current procedure, like you would think. The net result was that when the UPDATE in the original procedure was run, the NOCOUNT flag was off and the server obligingly provided feedback that one row had been updated. That was enough for the IAsynchResult object to consider the process done.
So now, everything works just the way we want it to work.
|
|
|
|
|
I'm trying to count data in a table. I was able to do it, however, when a data exists more than once, it shows it again and counts it again
for example:
column_name Count
string 2
another string 1
same string 2
This is my query:
SELECT table_1,
(SELECT COUNT(column_1) FROM Records as t1 WHERE t1.column_1 = table_1.column_1) AS Count
FROM table_1
Can anyone suggest an approach that would solve such redundancy? Thanks!
|
|
|
|
|
try this
select distinct c1,count(c1) from table1 group by c1
Bob
Ashfield Consultants Ltd
|
|
|
|
|
oh shucks! stupid me! thanks!
|
|
|
|
|
No problem
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Do use the distinct keyword as suggested by Mr. Ashfield
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
Hi,
I have three jobs dependent on each other,ie i get my data in my application only if all the three jobs are executed.
The details of the three jobs are below.
1.It transfers the data from our client server to our server.
2.Process the data.
3.Loads the data in the cubes.
If i run the jobs manually then the jobs are executed successfully,but if i schedule the jobs then 1 or 3 fails.
I am not using any access permissions to run them manually or in scheduling.
So can any one tell the possible reasons for the failure of my job so that i can check it out.
|
|
|
|
|
You are going to have to find out why the jobs fail, we cannot help you there. If you have set the logging on the jobs then you can use that.
Presumably there are dependencies between the jobs (I thought you would need SSIS for that) and 2 cannot run until 1 is complete.
[edit]
So you did not like the answers you got last time you posted - idiot
When you run manually you use YOUR permissions
When the Job is run you use SQL Job service permissions - they are not the same, check it out.
Apply some logging
When you say you will get back with the details of the error DO THAT.
Bloody time wasting fool, can't take advise and reposts the same bloody question a few hours later, mutter, mutter
[/edit]
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
code1 code2 code3 code4
2233229 411.80 2233231 1
2233229 411.80 2233232 1
999708 298.20 960269 1
960268 210.50 999710 1
960268 210.50 999710 2
I want to get the the max of colonne code 2, the min of colonne code 3, the min of colonne 4
Ordred By Col 2 after the querry i want such result.
2233229 411.80 2233231 1
999708 298.20 960269 1
960268 210.50 999710 2
Coul anyone help?? thanks!!
|
|
|
|
|
If you get min of column4 (code4) then you have this result
2233229 411.80 2233231 1
960268 210.50 999710 1
999708 298.20 960269 1
but if you need result which u have post then you must find max of column4 (code4).
Query which gives result by getting min of column 4:
select code1, max(code2) as code2 ,min(code3) as code3,min(code4) as code4<br />
from mtable<br />
group by code1<br />
order by code1
Query which gives result by getting max of column 4:
select code1, max(code2) as code2 ,min(code3) as code3,max(code4) as code4<br />
from mtable<br />
group by code1<br />
order by code1
I Love T-SQL
"Don't torture yourself,let the life to do it for you."
If my post helps you kindly save my time by voting my post.
|
|
|
|
|
Hello,
i am using OLEDB (MFC - VS2005) to read data from Excel File. I used class CTables and CColumns to get respectivly Sheet and Columns datarows:
pTableset->Open(session, NULL, NULL, NULL, _T("TABLE"));
pColumnset->Open(session, NULL, NULL, pTableset->m_szName);
Now i would know how i can get Rows and how i could use
Open method to get Type Cell.
Thanks for your support.
Best Regards,
Carmine.
|
|
|
|
|
Hi,
I have written a query to extract data from a table whose created date lies between current date and 30 days ago.in PL/SQL
I have written query as follows:
select creat_dt from shpt
where shpt.creat_dt between trunc(sysdate) and trunc(sysdate-30)
Although it is having records for which created date falls between current date and 30 days prior to current date, it still shows me no records extracted.
Help me with this.
|
|
|
|
|
Don't know about Oracle, but in SQL Server that wouldn't work, you have to put the earliest date first.
where shpt.creat_dt between trunc(sysdate-30) and trunc(sysdate)
It's not logical, but thats how it works in SQL Server and I suspect Oracle!
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Yap, this applies to Oracle also.
Based on ANSI standard between is converted to:
Field >= StartValue AND Field <= EndValue
Logical, isn't it
|
|
|
|
|
hi,
try swap the dates
between 20-10-2000 and 25-10-2001
between 25-10-2001 and 20-10-2000
it has to work no reason for otherwise
nelsonpaixao@yahoo.com.br
trying to help & get help
|
|
|
|
|
Hi friends,
When i schedule my jobs they fail after executing for few seconds,but when i execute the same job manually its executed.I am unable to find the reason ..can any one help..
Regards,
Annu
|
|
|
|
|
User permissions?
Bob
Ashfield Consultants Ltd
|
|
|
|
|
no...i don't hv any thing like user permission..
Actually i am new to SQL and Database..
So any thing else i am missing out...????
|
|
|
|
|
When you run it its running with your security settings and permissions, when it runs as a scheduled job it isn't. So, does the account the scheduler is running under have the necessary pemissions in the database to perform what ever it is your sql does?
Bob
Ashfield Consultants Ltd
|
|
|
|
|
No we dont hv any security settings and permission.when run manually or scheduled.
|
|
|
|
|
Can u let me know the possible reasons so that i can have a cross check on it.
|
|
|
|
|
annu08 wrote: No we dont hv any security settings and permission.
Sorry, but you do, even if they are only the default ones - and this is not recommended.
Have a look to see what account your scheduled job runs under, then have a look in the security details under SQL Server Management to see what rights they have, at a server, database and table level in relation to yourself.
Other tahn that I have no suggestions as to why this is happening.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
k, will check the details and get back with the exact problem.
Anyway thank u.
Regards,
Annu
|
|
|
|