August 26, 2008 at 1:10 am
i wanna knw hw 2 create a cursor in sql server 2005 so that i can use to iterate through table rows n while iterating i want to compute some values n view them in the result set....
so any idea abt that ..??
Thnx
August 26, 2008 at 1:16 am
check out Books Online on how to use cursors. Why do you need cursors. They are really performance drags.
"Keep Trying"
August 26, 2008 at 1:41 am
Can you explain in more detail what you're trying to do? I'm sure someone will come up with a non-cursor approach.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
August 26, 2008 at 2:41 am
Ya i can explain ..... i have a table called Projects , n another called Individual .. n also other one ProjectIndividuals the Individual has an IndAge as a field i need to have a result Set like this
ProjectRefNo CategoryName CategoryCount
1abc <20 100
2abd <20 50
1abc 20-30 300 ,,,
and so on i need to define age ranges and compute counts for all projects
n categories....
hope u can understand me ...
thanks alot
August 26, 2008 at 4:55 am
Could you please post table creation scripts, sample data and expected output?
See - http://www.sqlservercentral.com/articles/Best+Practices/61537/
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
August 26, 2008 at 5:07 am
hmm i got ur point ..thanks but i really have no time ..
August 26, 2008 at 7:29 am
With that attitude, please let him use cursors...
N 56°04'39.16"
E 12°55'05.25"
August 26, 2008 at 7:57 am
szahran (8/26/2008)
hmm i got ur point ..thanks but i really have no time ..
In that case it's unlikely that anyone will be able to help you properly.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
August 26, 2008 at 8:02 am
ok i will try to ask in a better way next time thnx anyway
Viewing 9 posts - 1 through 8 (of 8 total)
You must be logged in to reply to this topic. Login to reply