November 30, 2009 at 2:48 am
Post can be deleted, solution has been found. Thanks
November 30, 2009 at 2:55 am
Couple questions.
Why do you want to do this with a cursor when a single update statement will do the job perfectly well?
Why are you denormalising the database? How are you going to keep that CustomerCount column correct as customers are added, deleted and updated?
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
November 30, 2009 at 3:08 am
Nice name 🙂
It is just a fictional, experimental database to mess around with is all. It's ok if it gets messed up a bit. I'm just trying to understand the structure of a cursor as I will be able to relate easier with this sample I've been playing with.
November 30, 2009 at 3:14 am
Stay away from cursors. They have their place (rarely) but they should not be used when there's a simple set-based alternative, as there is here.
Are you trying to learn SQL development, including the best way to do various things, or do you want a cursor, even though it's a poor way to solve problems like this?
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
Viewing 4 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply