Viewing 15 posts - 1,861 through 1,875 (of 3,500 total)
Can't see the image, but generally speaking, when you want "all possible combinations", you need a CROSS JOIN between two tables... If you had a table of Courses and...
July 24, 2016 at 8:49 pm
I'm not sure it matters if the table has data or not...
If you run some TSQL to append the data to the Archive table, and then run another that truncates...
July 24, 2016 at 7:00 pm
Like this?
CREATE TABLE TABLE1
(IDint,
XDATEdate );
CREATE TABLE TABLE2
(XDATEdate );
GO
insert into TABLE1 (ID, XDATE) values
(100,'20150505'),
(100,'20150506'),
(100,'20150507'),
(222,'20150505'),
(222,'20150506');
insert into TABLE2 (XDATE) values
('20150505'),
('20150506'),
('20150507'),
('20150508');
SELECT t1.id, t2.xdate as t2date
FROM table2 t2
LEFT JOIN table1 t1 on t1.xdate=t2.xdate;
Why not...
July 22, 2016 at 9:29 pm
If it's for a single stored procedure, wouldn't you just use WITH OPTION RECOMPILE?
July 21, 2016 at 10:21 pm
At first I thought using DelimitedSplit8K would work for this... but I guess I didn't read the fine print carefully enough.
That will happen at 1:30 in the morning sometimes!
July 20, 2016 at 12:27 am
Here's a good article to read that you can adapt to answer your question:
http://dba.stackexchange.com/questions/86415/retrieving-n-rows-per-group
At least then you can give it a try and report back if you have problems. Helping...
July 19, 2016 at 11:36 pm
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
Viewing 15 posts - 1,861 through 1,875 (of 3,500 total)