| Author |
Topic |
|
supersql
Yak Posting Veteran
99 Posts |
Posted - 2008-07-10 : 12:39:26
|
| How can work with store proc without using cursors? |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-07-10 : 14:13:21
|
| No use posting your entire code. just specify what you're trying to do here with some sample data. I'm sure people will find more easy to follow and help rather than reading and understanding this posted code. |
 |
|
|
supersql
Yak Posting Veteran
99 Posts |
Posted - 2008-07-10 : 14:21:07
|
| Cursors are degrading performance in this case, am looking for a way without using cursors. |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-07-10 : 14:36:27
|
quote: Originally posted by supersql Cursors are degrading performance in this case, am looking for a way without using cursors.
that we understood. But nobody will have time to read the full code and understand what its doing. thats why i suggested you to explain with some data what you're trying to do here so that we can provide soln without using cursors. |
 |
|
|
supersql
Yak Posting Veteran
99 Posts |
Posted - 2008-07-10 : 14:56:13
|
| what am trying to do is1.For the given auditid(parameter)am getting datefor that audit2.GEt the id of the last audit for the given floorid3.by that i'll get the previous audit information to the result set4.then i'll get the current profile to add if any are missinganyways here is the sample result setAuditItemID,AuditItemName,IsGroupHeader,GroupHeaderHasItems,ZoneID, Score, InspectionItemId, Comment, ScoreTypeId, PreviousScore657 | Conference Rooms | 1 |0 |1 |3.5 |1220606| |3 |3.5658 Corridors and Hallways 1 1 2 NULL 0 3 NULL898 Corridors and Hallways - Production 0 0 2 3 1220607 3 3899 Elevators 0 0 2 3 1220608 3 3897 Office 0 0 2 NULL 0 3 NULL900 Stairwells 0 0 2 3 1220609 3 3 |
 |
|
|
supersql
Yak Posting Veteran
99 Posts |
Posted - 2008-07-10 : 16:16:51
|
| can i make use of CTE's here. |
 |
|
|
Lamprey
Master Smack Fu Yak Hacker
4614 Posts |
Posted - 2008-07-10 : 16:28:34
|
| I see several tables in your cursor solution and only a result set above. Can you provide sample data (create and insert statements) so that we don't have to guess and/or make up sample data? As well as the expected output (which is what I think yoiu have listed above. Feel free to check the FAQ if you need more info on how to provide sample data. |
 |
|
|
supersql
Yak Posting Veteran
99 Posts |
Posted - 2008-07-10 : 16:44:37
|
| I request u guys to check this post where i have given all the DMLhttp://www.sqlservercentral.com/Forums/Topic531281-338-1.aspx |
 |
|
|
TG
Master Smack Fu Yak Hacker
6065 Posts |
Posted - 2008-07-10 : 17:21:13
|
You should guess that since you are not getting a usable solution from either this forum or from your post on sqlservercentral.com that your question is just not well formed. And the time it takes to understand your objective based on the posted code is just not worth the effort (at least for me).What you posted on the other thread is just the DDL of the source tables. You need to post:- That DDL code here- Some DML to populate those tables with sample data that can be used to generate your desired output.- Inputs to your SP- Desired output.- If the rules to achieve your desired output is not obvious then please post a simple but complete explaination.this isn't too bad for steps 1-3:quote: 1.For the given auditid(parameter)am getting datefor that audit2.GEt the id of the last audit for the given floorid3.by that i'll get the previous audit information to the result set4.then i'll get the current profile to add if any are missing
but for 4 I don't know what you mean by current profile and add what to what if any of what are missing?Be One with the OptimizerTG |
 |
|
|
|