May 27, 2010 at 6:52 pm
Maddy...! (5/27/2010)
sorry buddy.............. if u r really talented enough jst solve it here itself
You can see what happened because of the your post... you even have people adding you to their personal "black list"... some very knowledgeable and otherwise friendly people, I may add. I don't know what kind of day you were having when you responded in the fashion you did but I'd recommend that you apologize especially to the person you were addressing. Heh... or not. Let's see what kind of metal you're made of. 😉
--Jeff Moden
Change is inevitable... Change for the better is not.
May 27, 2010 at 8:53 pm
Wise words Mr Moden (as usual). I did find that post arrogant and rude, but so much so it was almost funny (maybe that's just me though).
It (normally) takes more than one such comment to make my blacklist - so I'm going with benefit of the doubt for the time being. Hopefully it was a one-off, though it will be interesting to see if any sort of apology or explanation is forthcoming.
Side note: if this was a 'homework'-type question, Maddy might be in for a shock if he or she presents the code I submitted as-is. I am pretty sure that not too many students would write the solution that way, so it should be obvious to any reviewer that outside help was involved...
Side side note: the thing that irked me most here was the use of text speak (and 'dear'!). "Tan Q" grates on me to an extent I cannot adequately convey in words.
Paul White
SQLPerformance.com
SQLkiwi blog
@SQL_Kiwi
May 27, 2010 at 10:13 pm
Jeff Moden (5/27/2010)
Lynn Pettis (5/27/2010)
Jeff Moden (5/27/2010)
Heh... I remember not being able to do this type of stuff especially since UPDATE requires a bit of different handling than just a simple SELECT. No problem is trivial when you're under the gun and you just don't know how to do something. 😉 The OP even took the time to post data correctly.I do, however, agree that a nicer response to Dave's suggestion would have been much more appropriate.
I guess it depends on one's definition of trivial. If you can easily generate a SELECT statement that returns a result set that shows both current and future values, it isn't that hard to use that as input in an UPDATE statement, IMHO.
I do remember a day when I couldn't do such a thing if my life depended on it. Just because it's a trivial task for me now doesn't make it any less trivial then. 😉
No question, though. The OP was terribly rude. Looking back at the OPs other posts, it doesn't seem to be the "norm" to be rude and I can't help but think the OP was under the gun and took it out on the wrong folks. Heh... none of us has ever done that before, huh? :hehe:
Hard for me to say, used a very similar process at a previous employer. Used SQL Server to perform price changes in the inventory system. We could code, test, verify, and generate an update file in one day whay would take two weeks to accomplish writing a COBOL program to accomplish. Same principle, SQL generated a result set that was subsequently used by a generic COBOL update program to perform the actual price change. Process seemed natural to us and trasfers quite well to update SQL tables.
May 27, 2010 at 10:25 pm
Mr. Moden
I gave that statement bcoz Dave gave me some blog link to verify so i asked him and told him if you can solve it solve it here Paul gave the reply addressing me lazy maddy but the reason is i was completely confussed of solving a small update statement and so posted that on forums
and i do believe that we are here not to talk on this issues but to share some knowledge and solve problems of one another. If you really want my apolize i will
"Hey paul i apologize for it"
but remember i never post anything without me trying out by my own
So, After spending enough time on that update statement i came to knw that i stepped in a wrong shoe and so posted it for you and i dont have enough time too.....
these are my trials i went with before posting it to you
/*
select doco,doctype,(select max(cpnt) from dbo.ttest where doco = t.doco and doctype = t.doctype) as cpnt
from dbo.ttest t
select * from dbo.ttest
update .ttest
set cpnt = case (select max(cpnt)
from dbo.ttest
where doco = ttest.doco and
doctype = ttest.doctype )+1
update dbo.ttest set cpnt = ( select row_number() over (partition by doco,doctype order by doco,doctype) as rownumber
from dbo.ttest x where doco = ttest.doco and doctype = ttest.doctype )
with ttbl as
(
select doco,doctype,row_number() over (partition by doco,doctype order by doco,doctype) as rownumber
from dbo.ttest x
)update dbo.ttest set cpnt = ttbl.rownumber from ttbl inner join ttest on ttest.doco = ttbl.doco and
ttest.doctype = ttbl.doctype
select
row_number() over (order by doco,doctype) as rNUM,
row_number() over (partition by doco,doctype order by doco,doctype) as rpNUM,doco,doctype
from
dbo.ttest x
update dbo.ttest set cpnt = 0
select * from dbo.ttest order by doco,doctype
update ttest set cpnt =
isnull((select max(cpnt) from dbo.ttest x
where x.doco = ttest.doco and x.doctype = ttest.doctype),0) + 1
where doco = 1
update ttest set cpnt = t1.rpNUM
from (
select
row_number() over (order by doco,doctype) as rNUM,
row_number() over (partition by doco,doctype order by doco,doctype) as rpNUM,doco,doctype
from
dbo.ttest x ) as t1 inner join (
select
row_number() over (order by doco,doctype) as rNUM,
row_number() over (partition by doco,doctype order by doco,doctype) as rpNUM,doco,doctype
from
dbo.ttest x ) as t2 on t1.rNUM = t2.rNUM
update dbo.ttest set cpnt = NULL
select * from dbo.ttest
update dbo.ttest set cpnt = NULL
with cte as
(
select *,ROW_NUMBER() Over(partition by ttest.doctype ,ttest.doco order by ttest.doco) AS Rn
from ttest,
(select t.doctype as Rn1 from ttest t group by t.doctype) asa
)
select doco,doctype,rn from cte
*/
May 27, 2010 at 10:42 pm
Maddy...! (5/27/2010)
Mr. ModenI gave that statement bcoz Dave gave me some blog link to verify so i asked him and told him if you can solve it solve it here Paul gave the reply addressing me lazy maddy but the reason is i was completely confussed of solving a small update statement and so posted that on forums
and i do believe that we are here not to talk on this issues but to share some knowledge and solve problems of one another. If you really want my apolize i will
"Hey paul i apologize for it"
:w00t: This is one of the best confusion i have ever seen here on SSC.
Dave didn't give you the link to verify or to brag about it. Thats his signature my dear.
And if you really want to apologize, apologize to Dave and Mitesh too. They are the ones whom you offended the most and i am sure everybody will forget this episode once they understand what really happened.
How to post data/code on a forum to get the best help - Jeff Moden
http://www.sqlservercentral.com/articles/Best+Practices/61537/
May 27, 2010 at 11:06 pm
Maddy...! (5/27/2010)
Mr. ModenI gave that statement bcoz Dave gave me some blog link to verify so i asked him and told him if you can solve it solve it here Paul gave the reply addressing me lazy maddy but the reason is i was completely confussed of solving a small update statement and so posted that on forums
and i do believe that we are here not to talk on this issues but to share some knowledge and solve problems of one another. If you really want my apolize i will
"Hey paul i apologize for it"
but remember i never post anything without me trying out by my own
So, After spending enough time on that update statement i came to knw that i stepped in a wrong shoe and so posted it for you and i dont have enough time too.....
these are my trials i went with before posting it to you
Heh... believe me... I understand what you went through. Look at my other posts on this thread about it not being a trivial task if you don't know how to do it.
As for "we are here not to talk on this issues"... you really should have thought about that before you lit off like you did. Had you taken a minute to explain what you had done like you just did instead of just flaming someone, none of this would have happened.
--Jeff Moden
Change is inevitable... Change for the better is not.
May 27, 2010 at 11:51 pm
Good enough explanation for me. Funny about the confusion over Dave's signature.
I retract the 'lazy' comment, partially. Clearly Maddy made a lot of effort was made to solve the problem himself; it's just unfortunate that the first post gave us no clue to that. So, the first post was lazy, but that's about all.
Paul White
SQLPerformance.com
SQLkiwi blog
@SQL_Kiwi
May 28, 2010 at 1:54 am
Feeling the SSC love in the forum today 🙂
Maddy , maybe my response to you was a little terse. Im glad to see that you mistaking my sig for an answer resulted in your comment, still not justified though. However, I think the onus is on question posters to provide as much detail , your statement of
but remember i never post anything without me trying out by my own
may well be true, and if true you should really of demonstrated this in your original post. That way you would of got better and more relevant feedback.
and i do believe that we are here not to talk on this issues,but to share some knowledge and solve problems of one another
Which issue , your rudeness ? Why should we share knowledge with people who don't appreciate our aims. My personal aim , is not to provide outright answers, but to help people to help themselves. Sometimes that can , as in your case, a simple lookup XXX in Books On Line, others it can be hours of (UNPAID) work to dissect and re-engineer a query.
. If you really want my apolize i will
Only apologize if you want to, not because you feel obliged to. If you feel you have not to apologize for then dont.
May 28, 2010 at 8:05 am
Paul White NZ (5/27/2010)
UPDATE LazyMaddy
SET cpnt = LazyMaddy.q
FROM (
SELECT T.cpnt,
q = ROW_NUMBER() OVER (
PARTITION BY T.doco, T.doctype
ORDER BY (SELECT 0))
FROM dbo.ttest T
) LazyMaddy;
Always nice to see people using proper aliases in their code 😉
Viewing 9 posts - 16 through 23 (of 23 total)
You must be logged in to reply to this topic. Login to reply