# What is RBAR? How can I avoid it?

• Jeff, Thanks for your timely good spanking for using the TVF. I wouldn't use/propose this next time and you will see me use the numbers table here next time.

[font="Courier New"]Sankar Reddy | http://SankarReddy.com/[/url][/font]

• Sankar Reddy (1/26/2009)

Jeff, Thanks for your timely good spanking for using the TVF. I wouldn't use/propose this next time and you will see me use the numbers table here next time.

Heh... think of it as "Cardinal" punishment. 😛 Thanks for the feedback, Sankar.

--Jeff Moden

RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
First step towards the paradigm shift of writing Set Based code:
________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

Change is inevitable... Change for the better is not.

How to post code problems
How to Post Performance Problems
Create a Tally Function (fnTally)

• Lynn Pettis (1/26/2009)

Cardinal Moden is an excellent resource in the fight against RBAR. I must admit to having learned quite a bit from his excellent mentoring via SSC.

Dang, Lynn... thanks for the awesome compliment. You've certainly made my day! I'll also say that "one voice in the crowd" just wouldn't make it work. Thank you for all of your support and the great examples you've posted, yourself!

--Jeff Moden

RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
First step towards the paradigm shift of writing Set Based code:
________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

Change is inevitable... Change for the better is not.

How to post code problems
How to Post Performance Problems
Create a Tally Function (fnTally)

• Jeff Moden (1/26/2009)

Lynn Pettis (1/26/2009)

Cardinal Moden is an excellent resource in the fight against RBAR. I must admit to having learned quite a bit from his excellent mentoring via SSC.

Dang, Lynn... thanks for the awesome compliment. You've certainly made my day! I'll also say that "one voice in the crowd" just wouldn't make it work. Thank you for all of your support and the great examples you've posted, yourself!

And that compliment will be seen again tomorrow when my article is published.

You are an excellent source of information and ways of doing things. I wish I'd learned of this sight much earlier in my career. With individuals like you, Gail, Gus, Grant, and many others I would have learned even more by now.

So to Steve, again thanks for such a wonderful site on MS SQL Server!

• bjesmith2 (1/26/2009)

Jeff,

All of your responses were excellent! I was astonished by the number of replys to what I thought would be an afterthought question for most of you. I truly appreciate all of the posts.

Also, In your last post you mention the "shift" in thinking that's needed to use set based programming. This shift is exactly what I'm looking for.

My primary job is to pushing out reports through SSRS or whatever else is thrown at me. Therefore, to have quick running reports, I'm always looking for ways to make queries that run as quickly as possble.

However, I must admit all of my queries must have RBAR (I just didn't know). When I came across your article describing RBAR in triangular joins (which I've used with smaller datasets) and set based programming. You showed me there is a better way.

As I mentioned in my previous reply. I need a little time to read all of the posts and try out a few things with my reports. However, I look forward to sharing how this all works out with each of you. Thanks again.

Just to follow up, howzitgoin?

--Jeff Moden

RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
First step towards the paradigm shift of writing Set Based code:
________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

Change is inevitable... Change for the better is not.

How to post code problems
How to Post Performance Problems
Create a Tally Function (fnTally)

• Heh... must've got stuck in a loop somewhere. 😉

--Jeff Moden

RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
First step towards the paradigm shift of writing Set Based code:
________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

Change is inevitable... Change for the better is not.

How to post code problems
How to Post Performance Problems
Create a Tally Function (fnTally)

• Jeff Moden - Wednesday, February 22, 2017 9:51 PM

Heh... must've got stuck in a loop somewhere. 😉

You must love this thread, Jeff. You keep reviving it every few years with another post. 🙂

"Do not seek to follow in the footsteps of the wise. Instead, seek what they sought." - Matsuo Basho

• Nah... I was doing some research and it popped up on the radar.  Couldn't resist. 😉

--Jeff Moden

RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
First step towards the paradigm shift of writing Set Based code:
________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

Change is inevitable... Change for the better is not.