Viewing 15 posts - 47,881 through 47,895 (of 59,099 total)
:P;)
--Jeff Moden
Change is inevitable... Change for the better is not.
October 7, 2008 at 8:01 pm
TenDayIT...
As it turns out, your original code had the same flaw as the modified code... bad Dynamic SQL if more than 1 parameter is provided.
I can help, but I need...
--Jeff Moden
Change is inevitable... Change for the better is not.
October 7, 2008 at 7:57 pm
tendayit (10/7/2008)
Hi,Please find attached the modified code.
Thanks
Tendayi
Your new proc delivers bad SQL if more than one input parameter is provided... here's what the Dynamic SQL it creates looks like when...
--Jeff Moden
Change is inevitable... Change for the better is not.
October 7, 2008 at 7:17 pm
Heh... I recognize that, Clint. And, I'm not being evasive about code. I just recognize that you're both intelligent as well as being a bit new to SQL....
--Jeff Moden
Change is inevitable... Change for the better is not.
October 7, 2008 at 6:50 pm
jcrawf02 (10/7/2008)
Jeff Moden (10/6/2008)
This forum is a bit odd... it sometimes turns left parenthesis into smiley faces.I'm sorry, is that one statement or two? 😀
Heh... now that I...
--Jeff Moden
Change is inevitable... Change for the better is not.
October 7, 2008 at 6:42 pm
jcrawf02 (10/7/2008)
Or are we waiting for Porkslinger 😛 to give us another followup article?
Heh... what an idea... maybe I'll title it "Porkslinger: Have Chops, Will Travel." 😛
--Jeff Moden
Change is inevitable... Change for the better is not.
October 7, 2008 at 8:22 am
... and, if you write it correctly, it will also do just one "record" correctly, as well.
--Jeff Moden
Change is inevitable... Change for the better is not.
October 7, 2008 at 8:15 am
Two set based "passes", if needed, will still be light years faster than nested loops.
I'm "old school", too, but I sure don't mind being called "Jeff" on these forums. ...
--Jeff Moden
Change is inevitable... Change for the better is not.
October 7, 2008 at 8:07 am
dr_csharp (10/7/2008)
CREATE TRIGGER test ON CallRecorder
FOR INSERT
AS
DECLARE @RecId INT;
DECLARE @BeginTime NVARCHAR(8);
SELECT @RecId=RecId,@BeginTime=BeginTime FROM Inserted
set @BeginTime=substring(@BeginTime,1,3);
Update CallRecorder
...
--Jeff Moden
Change is inevitable... Change for the better is not.
October 7, 2008 at 8:03 am
GilaMonster (10/7/2008)
Jeff Moden (10/7/2008)
--Jeff Moden
Change is inevitable... Change for the better is not.
October 7, 2008 at 7:55 am
J (10/7/2008)
Another application where I was dead sure the only way to do it was a double set of cursors: calculating the FIFO value of an inventory.
Outer loop: items...
--Jeff Moden
Change is inevitable... Change for the better is not.
October 7, 2008 at 7:49 am
J (10/7/2008)
Well, cursors are easy to code. Is there a place on this earth where they are the most appropriate solution ?
Actually, in SQL Server 2000, there are places where...
--Jeff Moden
Change is inevitable... Change for the better is not.
October 7, 2008 at 7:47 am
Oh yeah... almost forgot... you could also use UNPIVOT... look it up. I don't use it... I normally do it the way you did it.
--Jeff Moden
Change is inevitable... Change for the better is not.
October 7, 2008 at 7:37 am
The way you did it is fine, Karthik... only change I would make is to change all the UNION's into UNION ALL for performance and data integrity reasons. UNION...
--Jeff Moden
Change is inevitable... Change for the better is not.
October 7, 2008 at 7:36 am
Dugi (10/7/2008)
Jeff Moden (10/7/2008)
--Jeff Moden
Change is inevitable... Change for the better is not.
October 7, 2008 at 7:32 am
Viewing 15 posts - 47,881 through 47,895 (of 59,099 total)