Viewing 15 posts - 3,031 through 3,045 (of 5,504 total)
I would probably use PATINDEX(). Something like
DECLARE @search CHAR(2)
SET @search='sm';
WITH tab AS
(
SELECT 'Smith' AS lastname, 'John' AS firstname UNION ALL
SELECT 'GoldSmith', 'Vincent' UNION ALL
SELECT 'Smith', 'Patrick' UNION ALL
SELECT 'Blacksmith',...
August 9, 2010 at 12:53 pm
Would something along the following lines help you? (the "trick" is to build subgroups by contract_type as shown with the subgrp aliased column)
;
WITH cte AS
(
SELECT
*,
ROW_NUMBER() OVER(ORDER BY...
August 6, 2010 at 4:25 pm
Please provide table def, sample data and expected result together with what you've tried so far. For details on how to post sample data please see the first link in...
August 6, 2010 at 10:11 am
But I don't think it's going to change the concept in general 😉
It just leaves a little more work to do for the OP to modify the solution...
August 6, 2010 at 3:55 am
Chris Morris-439714 (8/6/2010)
Chris, please take the time to set up the sample data properly. The whole batch should run without errors, and the column names and types must match those...
August 6, 2010 at 3:41 am
Matthew VanDerlofske-459596 (8/5/2010)
Thank...
August 5, 2010 at 12:15 pm
Continuing my prev. post: You have an index lApprovalId and lItemId. Using the phone book example your index is sorted by last name (=lApprovalId) and first name (=lItemId).
But your WHERE...
August 5, 2010 at 11:24 am
Matthew VanDerlofske-459596 (8/5/2010)
August 5, 2010 at 10:27 am
Ok, here's what I came up with so far:
SELECT
RP.PERIODNAME,
[1.1] = COUNT(CASE WHEN C.CASETYPE = 'F' AND C.PROPERTYTYPE = 'P' AND RIGHT(C.IRN, 2) = 'PA' AND CE.EVENTNO = -16 AND MONTH(CE.EVENTDATE)...
August 5, 2010 at 10:13 am
Matthew, do you have an example that will actually trigger both parts of the UNION statement? With the data you provided I would suggest to delete the secon UNION part...
August 5, 2010 at 9:10 am
GilaMonster (8/4/2010)
Steve Jones - Editor (8/4/2010)
We have that clock in the kitchen in our house. People think it's funny.
My supervisor at the university has a very irritating clock. No numbers...
August 4, 2010 at 6:10 pm
Hmm.... it seems like the execution plan got lost somewhere in between (2 bytes doesnt sound right...).
Anyway. Step 1 would be to replace UNION with UNION ALL to eliminate a...
August 4, 2010 at 5:45 pm
Matthew VanDerlofske-459596 (8/4/2010)
it seems...
August 4, 2010 at 10:24 am
Please provide table DDL and sample data.
Based on what you've provided so far, I guess there a re some missing rows in your B cte.
Hard to tell without sample data...
August 4, 2010 at 6:53 am
Changing the function into an inline-table valued function would also help, I guess...
CREATE FUNCTION [DSUSER].[BDP_WPS_Approvals] (@lWPSID AS INT)
RETURNS TABLE
AS
RETURN
(SELECT
(SELECT
a.lUserID ID,
a.lApprovalState...
August 4, 2010 at 6:48 am
Viewing 15 posts - 3,031 through 3,045 (of 5,504 total)