July 29, 2009 at 9:03 pm
jqd2001 (7/29/2009)
How is that? There's nothing in what you've told us that would lead to that conclusion.
Barry,
I just finished writing all 10 user TVF in T-SQL. Another developer wrote similar report using one SQL code block, very hard to read and I even help him to find why some data did not return by looking at individual functions. At least for me, procedural code look simpler-- break down code, row by row update.
Jack
Not an answer to my question. Cursors aren't necessary and probably not helpful. Jeff (and I) was talking about Cursors and loops, not TVF's. In-line TVF's are fine. I repeat what I said before, there is no reason to believe that your only choices are cursor-based code or 1500-line procedures.
[font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
Proactive Performance Solutions, Inc. [/font][font="Verdana"] "Performance is our middle name."[/font]
August 2, 2009 at 5:06 pm
Jeff (and I) was talking about Cursors and loops, not TVF's. ...there is no reason to believe that your only choices are cursor-based code or 1500-line procedures.
Barry,
For big block of T-SQL I saw, would you break it down into 10 procedures or keep it a 1500 line of code ?
What other ways to update rows in a temp tables ?
( I did some update by inner join and need to do
severy updates since some return no row).
Do These relate to your question ?
Jack
August 2, 2009 at 6:48 pm
jqd2001 (7/23/2009)
there should be no need for "procedural feature" nor a cursor to loop through rules no matter how complicated
Jeff,
In that sense, we will end up with a SQL code block about 10*150=1500 lines and growing. I would not consider that readable:
I wish to have an SQL editor that can hide code block in the region like C# so I can live without Moden language.
Jack
Empirically speaking, the enforcement of such rules actually belongs in the business layer, not the data layer. That not withstanding, you're making an assumption that I'd do something crazy like that and that I wouldn't be able to come up with a better way. The bad part here is that I can't defend my statements against the unknown and the unknown here is your set of rules.
Table driven rules do not need to be procedural in nature if they are created correctly.
Heh... and you should try living with "Moden language"... I do it all the time and it's made my life very simple especially in code. 😀 That being said, be real careful not to make this personal or some form of ad hominem attack... I'm trying to quit smoking and I do have a bucket of pork chops just waiting... 😉
--Jeff Moden
Change is inevitable... Change for the better is not.
August 2, 2009 at 7:14 pm
jqd2001 (8/2/2009)
Jeff (and I) was talking about Cursors and loops, not TVF's. ...there is no reason to believe that your only choices are cursor-based code or 1500-line procedures.
Barry,
For big block of T-SQL I saw, would you break it down into 10 procedures or keep it a 1500 line of code ?
What other ways to update rows in a temp tables ?
( I did some update by inner join and need to do
severy updates since some return no row).
Do These relate to your question ?
Jack
Which big block of T-SQL, Jack? None has been posted on this thread, yet.
--Jeff Moden
Change is inevitable... Change for the better is not.
August 2, 2009 at 7:19 pm
I also say that if you've broken it down to 10 procedures that there's nothing wrong with that... unless the procedures only handle one row at a time and then you've really accomplished nothing performance wise...
--Jeff Moden
Change is inevitable... Change for the better is not.
August 2, 2009 at 7:36 pm
jqd2001 (7/23/2009)
...I wish to have an SQL editor that can hide code block in the region like C# so I can live without Moden language.
Jack
Hmm, I missed this point before, but... you can actually get this very feature in SQL Server 2008's Management Studio.
[font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
Proactive Performance Solutions, Inc. [/font][font="Verdana"] "Performance is our middle name."[/font]
August 2, 2009 at 7:42 pm
jqd2001 (8/2/2009)
Jeff (and I) was talking about Cursors and loops, not TVF's. ...there is no reason to believe that your only choices are cursor-based code or 1500-line procedures.
Barry,
For big block of T-SQL I saw, would you break it down into 10 procedures or keep it a 1500 line of code ?
...
Hard to say without seeing the code. That is one possibility that I have used in the past, but there are a lot of other ones too. Views, CTEs, in-line TVF's are all possible tools. As is trying a completely different approach or re-engineering the architecture to make things like this more straight-forward. Lots more possibilities too.
[font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
Proactive Performance Solutions, Inc. [/font][font="Verdana"] "Performance is our middle name."[/font]
August 2, 2009 at 11:00 pm
Jeff,
I do read all your guys comments and it is now hard to quote now:
(1) I am dealing with Crystal report in a closed sysetm so cannot have my own business object running.
(2) This thread is originally about failing to use SQL CLR and I am working on reprocuding and fix it ( thanks for suggestions on that by members of this forum)
(3) Yes, my TVF function returns multiple row so is not deal with one row at a time.
I think I can carry all you wisdom forward with this project. I wish I can dump code here but users will cut my head off since most are very sensitive information with monetary impact.
Jack
August 2, 2009 at 11:10 pm
Barry,
Thanks for you comments:
(1) I will try CTE, View and SQL 2008 Editor. Very good suggestions
(2) Re-engineering is not possible since it is a closed sysetm Crystall report. I can only do data manipulated in Database.
Jack
August 3, 2009 at 1:36 am
jqd2001 (8/2/2009)
Jeff,I do read all your guys comments and it is now hard to quote now:
(1) I am dealing with Crystal report in a closed sysetm so cannot have my own business object running.
(2) This thread is originally about failing to use SQL CLR and I am working on reprocuding and fix it ( thanks for suggestions on that by members of this forum)
(3) Yes, my TVF function returns multiple row so is not deal with one row at a time.
I think I can carry all you wisdom forward with this project. I wish I can dump code here but users will cut my head off since most are very sensitive information with monetary impact.
Jack
Then why were you insisting that anything I would do would take 1,500 rows? Never mind... you were thinking that I coded like some of the folks you work with.
Glad to see you at least giving the suggestion of a non-RBAR solution a try. I trully hope that whatever you do turns out to be performent because users will also cut your head off since most are also "very sensitive information with monetary impact" for slow code. Good luck, Jack. Seriously.
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 10 posts - 16 through 25 (of 25 total)
You must be logged in to reply to this topic. Login to reply