Viewing 9 posts - 1 through 9 (of 9 total)
SELECT
[object_idx] = ROW_NUMBER() OVER (ORDER BY [type_desc]),
[group_idx] = DENSE_RANK() OVER (ORDER BY [type_desc]),
[group_name] = [type_desc],
[group_object_idx] = ROW_NUMBER() OVER (PARTITION BY [type_desc] ORDER BY [name]),
[object_name] =...
December 5, 2013 at 9:35 am
Assuming that omsid and Recordtype form a unique composite index, he is trying to find a count of omsid's that have both a 'promo' and an 'event' Recordtype.
December 3, 2013 at 9:27 am
Hugo, that's why I suggested having one column per parameter in my previous post - so that they can be strongly typed rather than stored as strings as in the...
September 3, 2013 at 4:28 am
The parameters for a stored procedure have to be declared at design time and, presumably, you need to know how those parameters will be used within the procedure. So, if...
September 3, 2013 at 2:08 am
Thanks for including my solution in the test results 🙂 I know it's not the fastest but it feels more "real world" because you usually need to take the year...
August 5, 2013 at 2:07 am
Haven't read through all the replies so apologies if this has already been posted!
You could do use this code to group and sort by month AND year:-
;WITH [Data] AS (
...
August 2, 2013 at 8:22 am
Try this ...
;WITH [Period] ([StartDate]) AS (
SELECT DATEADD(month, DATEDIFF(month, 0, GETDATE()) - [number], 0)
FROM [master]..[spt_values]
WHERE [type] = 'P'
AND [number] BETWEEN 0...
January 24, 2012 at 7:13 am
If the specification is for a single operation with an integer on either side ...
CREATE FUNCTION [SimpleMath](@expression VARCHAR(max))
RETURNS INT
AS
BEGIN
DECLARE
@position INT,
@operator CHAR(1),
@left INT,
@right INT,
@result INT
SELECT
@position = PATINDEX('%[*/+-]%', @expression),
@operator = SUBSTRING(@expression, @position,...
November 23, 2011 at 9:23 am
Unfortunately, when you're working for a consultancy firm, thinking time is usually unaccountable and non-chargeable.
Most of my thinking time happens when I'm asleep. I actually wake up with fully-fledged portions...
July 27, 2010 at 6:56 am
Viewing 9 posts - 1 through 9 (of 9 total)