Viewing 15 posts - 451 through 465 (of 475 total)
Without something to test this against and using Dwain's tip on the row_number, the following may do what you want
;WITH NewIDAllRecords AS (
SELECT
jobDB.num AS JobNumber,
DateAdd(minute, 570, jobDB.entered) AS...
November 1, 2012 at 7:47 pm
Luis Cazares (11/1/2012)
Micky,Your first query is not sargable and that would make it pretty inefficient compared to the second one. 😉
True :Whistling:
Not knowing what the data is for, I suspect...
November 1, 2012 at 3:31 pm
Assuming that your data is always in the format that you have indicated, you could try
create table #Table1
(
SONumber varchar(10)
)
create table #Table2
(
SONumber varchar(10)
)
insert #Table1
select '123'
insert #Table2
select '123/1'
select *
from #Table1 t1
left...
November 1, 2012 at 2:59 pm
Luis Cazares (11/1/2012)
November 1, 2012 at 12:53 pm
Hi
Does this do what you want? I've used sum to aggregate the WholeACNet.
SELECT Region_Code,
[Original],
[RiverLakes_WWFL],
[RiverLakesSev123_WWFL]
FROM TestData
PIVOT (
SUM(WholeACNet)
FOR Description in (
[Original],
[RiverLakes_WWFL],
[RiverLakesSev123_WWFL]
)
) p
October 31, 2012 at 12:23 pm
The only confusion has been pointed out by john.arnott. The alias of the "LEAD (Sales,1) OVER (ORDER BY Sales)" should have been "SalesGoal", not "Sales".
May be I am interpretting it...
October 30, 2012 at 12:15 pm
{Me} How many columns can a table have?
{You} 1,024!
{Me} So why are INSERTs designed to handle up to 4,096 columns?
{You} {wtf???}
Something else to go and investigate 😀 Could be...
October 29, 2012 at 6:04 pm
Hi
I thought I would add in a LIKE query to see how that compared. It wasn't as bad as I thought it would be.
SELECT @StartTime = GETDATE();
SELECT @HOLDER...
October 25, 2012 at 1:07 pm
Hi
Rather than a procedure you could try a table valued function along the lines of
CREATE FUNCTION fnFooter (@p1 varchar(30) )
RETURNS TABLE AS RETURN
SELECT FooterID, REPLACE(Footer, '@client', @p1) Footer FROM...
October 22, 2012 at 4:00 pm
Be careful, now. Recursive CTE's that count or do other RBAR ops are nearly as bad and sometimes worse than While loops. Please see the following article for...
October 17, 2012 at 7:08 pm
S_Kumar_S (10/17/2012)
Although it works fine but why why do we need the UNION ALL part in the CTE?
This is a recursive CTE, so it will step through the string and...
October 17, 2012 at 12:35 pm
Hi Luis
As Eugene said, this could be replaced without using a cursor with something like the following.
This example may not be the best way to do it, but it has...
October 9, 2012 at 8:38 pm
Hi Gabe
Not sure if this is the logic you want to apply, but you may want to add join clauses for the FundID. Should improve it considerably. I...
October 8, 2012 at 6:36 pm
ben.brugman (10/8/2012)
(My reason for this change change is: The essential part of the code is only written once, so it is smaller, clearer and...
October 8, 2012 at 3:10 pm
Viewing 15 posts - 451 through 465 (of 475 total)