Ahh, I am so used to using collections I have forgotten what it is like to access the database directly. I would suggest you may want to take a look at your architecture, I presume you are using winforms and binding the datasets to the controls which is going to entail a lot of work to change.
Never underestimate the power of human stupidity
Yes man I am sorry I got pissed off with guy who wrote without comments, but good thing is I brought all my peace back again and I read it and fixed the issue. Thanks for reminding me of my mistake or anger, after all we are all human beings.
Sorry once again.
The code you have posted is far too big for someone to read and understand what you're trying t do in each section.
When you say that the procedure works fine if you call it using plain SQL and EXEC and it doesn't work when you call it from the application, the problem most likely resides in the application, not in the procedure.If the parameters are really the same in both cases the only thing that would change the procedure behaviour is changes in the database.
You should double check that the parameters leaving from your application are really the same. Use the debugger to check what happens in the calling code. If that seems valid then debug the procedure and see what happens. For more information see How to: Debug Stored Procedures[^]
I got it fixed, just asking one question that if we have Select statement in between on Table variables would the Stored procedure not work properly, I had it some where and I removed it. It was working fine on the Query Window because it displays all the Selects but wasn't working from UI probably it first select as record set may be my guess. If you know more clarify it is just an understanding discussion but the problem is resolved.
Thanks for all your support, and the person who wrote wasn't having comments to understand it better.
The BETWEEN condition needs two single values; the lower and the upper bound. For example:
WHERE NumColumn BETWEEN5AND10
In that example you can't replace neither 5 or 10 with table variables since then there would be more than one value in the comparison. You can think the BETWEEN condition as two separate conditions, like:
I have five tables say T1,T2,T3,T4,T5. Each table has different columns say like T1 has T1CL1,T1CL2,T1CL3
and Table T2 has T2CL1,T2CL2,T2CL3 and so on...
Now I want to Create a Stored procedure selecting only few columns from Each table and it should return everything in only one Dataset. Is it possible? If Yes... This is what I tried and didn't get anything I want.
Select T1CL1,T1CL2 from T1 where T1CL3 = 'Something'Select T2CL1,T2CL3 from T2 where T1CL2 = 'prm1'Select T3CL3,T3CL4 from T3 where T3CL2 = 'prm2'Select T4CL1,T4CL3 from T4 where T4CL2 = 'prm3'Select T5CL1,T5CL3 from T5 where T1CL2 = 'prm4'
But I don't know how save the data from each query and place everything from SP into a Dataset?
Can anyone help me with this Please
Your help is much appreciated.