Viewing 15 posts - 1,876 through 1,890 (of 3,509 total)
Is this close?
-- create a cursor to loop over this result set
/* create a cursor to loop through each table... */
DECLARE @CmdLine AS NVARCHAR(200);
DECLARE @CmdCursor AS CURSOR;
SET @CmdCursor = CURSOR...
July 18, 2016 at 9:46 pm
After taking Jeff's advice...
maybe this works?
SELECT Country
, AccountNum
, PolicyNum As CurrentPolicy
, LAG(PolicyNum,1) OVER (PARTITION BY Country, AccountNum ORDER BY PolicyEffDt) AS PrevPolicy
FROM @PolicyRelationship
ORDER BY Country
,AccountNum;
July 18, 2016 at 7:19 pm
Nothing to it
SELECT * FROM #TEMP
ORDER BY NEWID();
NEWID() generates a random number for each record, so sorting by it causes a "random" sort.
July 18, 2016 at 5:25 pm
This would be a much clearer question if you included sample data (create table scripts, insert scripts) and expected results.
July 17, 2016 at 8:14 pm
I could rewrite the code this way...
SELECT personID
FROM #gradPerson AS g
WHERE NOT EXISTS (SELECT TC.PersonID
FROM TranscriptCourse AS tc
WHERE tc.PersonID = g.PersonID
Are you saying you don't understand...
July 17, 2016 at 12:39 pm
What? I don't understand your question.
You've been here way too long to post questions like you do. No data, no table structures, nothing. As such, all I can do...
July 15, 2016 at 11:57 pm
CREATE TABLE scripts? INSERT scripts with dummy data? Lots easier to sort out with at least something to work with. Without that I can only hazard a guess.......
July 15, 2016 at 5:57 pm
Kevin,
Does your computer automatically play Pink Floyd whenever you're forced to work on it...? The till working in the background might be good incentive...
July 15, 2016 at 5:07 am
You can insert a row below the matrix outside the group and put the total there, and it will only show on the last page.
Right-click on the matrix/tablix, and in...
July 12, 2016 at 9:59 am
You're describing a matrix. You can add a totals column if you wish as part of the matrix.
July 12, 2016 at 8:10 am
I agree, but then it's not my homework. If you want good help, provide create table scripts etc.
July 12, 2016 at 8:09 am
Sorry, the more I read this, the more odd it sounds. Are you stuck with this table design? It just sounds a little off. I'm not sure i...
July 11, 2016 at 3:12 pm
You may need to use SUMMARIZE. Think of it like the DAX equivalent of a summary query in T-SQL... Complete with GROUP BY etc.
Here it is from the MS...
July 11, 2016 at 2:50 pm
In this case, I want to check to make sure the space is available for the entire date range, if not do not display the record.
In that case, you would...
July 9, 2016 at 8:21 pm
I would do this with a (deliberate) cartesian product between Calendar and ParkingSpaces...
SELECT p.ParkingSpace, c.CalendarDate
FROM ParkingSpaces p CROSS JOIN Calendar c
WHERE c.CalendarDate BETWEEN '01-Jan-2016' AND '31-Dec-2016';
then just insert that result...
July 9, 2016 at 1:55 pm
Viewing 15 posts - 1,876 through 1,890 (of 3,509 total)