Viewing 15 posts - 1,081 through 1,095 (of 3,957 total)
I hope that the OP realizes that it is no longer necessary to pass multiple values within a comma-delimited list to a SP.
Use a Table-valued Parameter instead.
The only question of...
November 20, 2013 at 7:58 pm
mickyT (11/20/2013)
dwain.c (11/20/2013)
I have one question though, for the 4D case. Are both queries returning the same row counts?
I was a little unsure about what I...
November 20, 2013 at 7:38 pm
Nice follow up Micky!
I have one question though, for the 4D case. Are both queries returning the same row counts?
I was a little unsure about what I did with...
November 20, 2013 at 7:09 pm
I can second what Jeff said about performance of LAG/LEAD as I've done some testing myself. Frankly I was not impressed in the admittedly limited testing that I have...
November 20, 2013 at 6:31 pm
As it turns out, I've been experimenting of late with product substitution tables and so far I have something that may work for you. Note that I have not...
November 20, 2013 at 6:16 pm
You can try to see if this will work for you.
create procedure uspDataGet
as
select Code = 'aswe'
union
select Code = 'hgtr'
GO
create procedure uspDataTEST
@Audit bit = 0
as
declare @tblResult table
(
Code char(10)
)
--populate @tblResult with the...
November 20, 2013 at 5:49 pm
It doesn't get much more elegant than that, but there are multiple ways to skin that same cat.
SELECT NewRow=b.ID
,Col1=MAX(CASE val WHEN 1 THEN Value ELSE ''...
November 20, 2013 at 5:28 pm
Abu Dina (11/19/2013)
Dwain's probably asleep right now.. I think he's from New Zealand. 🙂
Bangkok actually. 4-5 time zones removed from NZ.
November 19, 2013 at 6:33 pm
Start with a Calendar table. For this example, I'll give you my utility FUNCTION to generate a calendar on the fly.
CREATE FUNCTION [dbo].[GenerateCalendar]
...
November 19, 2013 at 6:04 pm
Laurence Neville (11/19/2013)
November 19, 2013 at 5:24 pm
Luis Cazares (11/19/2013)
WITH SampleData (ID, Data) AS
(
SELECT 'A', 'P1' UNION ALL
SELECT 'A', 'P1' UNION ALL
SELECT 'A', 'P2' UNION ALL
SELECT...
November 19, 2013 at 5:21 pm
Abu Dina (11/19/2013)
dwain.c (11/18/2013)
Abu Dina (11/18/2013)
Ah! Then you need to be introduced to the INTO Clause 😉
A couple of caveats to using this technique:
- All columns created will default to...
November 19, 2013 at 5:20 pm
November 18, 2013 at 10:35 pm
Use a Tally table.
WITH results AS
(
SELECT 1 day, 100 amt UNION ALL
SELECT 2 day, 200 amt UNION ALL
...
November 18, 2013 at 10:19 pm
Viewing 15 posts - 1,081 through 1,095 (of 3,957 total)