Download presentation
Presentation is loading. Please wait.
Published byMonica Carpenter Modified over 8 years ago
1
Said Salomon Unitrin Direct Insurance timelord@timelordshangout.com T-SQL Avoiding cursors Said Salomon
2
I have over 25 year experience IT. I have a vast array of abilities in the field in the areas of Network, Desktop Support, DBA, Staff Project Management, Application Software Development, Business Analysis and Quality Assurance. I have Microsoft certifications as MCTS, MCPS, and MCNPS, and multiple certifications from the Insurance Institute of America. Currently I am a DBA at Unitrin Direct Insurance.
3
A cursor is pointer into a rowset Allows a single row at a time to be processed DECLARE c1 CURSOR READ_ONLY
4
Most programmers have a process a row mindset (read a record process a record) Complex operations need to be done on each row
5
SQL is a rowset system Performance (system impact) Slower than using rowset logic Creates locks on the table more memory to accomplish the same task require more code to write
6
Use a case statement Multiple rowset operations Use a temp table with IDENTITY Using User Defined Functions use a common-table expression (CTE)
7
Demo
8
Avoiding cursors with SQL Server 2005 http://bit.ly/cVEOwJ http://bit.ly/cVEOwJ SQL Cursors - how to avoid them http://bit.ly/dvsVri http://bit.ly/dvsVri SQL Server 2008, Dev Edition http://bit.ly/L2hJQ http://bit.ly/L2hJQ My Twitter SaidSalomon
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.