Viewing 15 posts - 6,661 through 6,675 (of 8,731 total)
MyDoggieJessie (3/27/2014)
; WITH VisitTypes AS (SELECT PatientID, VisitType, ROW_NUMBER() OVER ( PARTITION BY PatientID, VisitType ORDER BY VisitDate) AS Cnt, VisitDate
FROM #visit_info_table
) SELECT TOP...
March 27, 2014 at 1:03 pm
Maybe something like this:
WITH FirstVisits AS(
SELECT PatientID,
VisitID,
VisitType,
VisitDate,
ROW_NUMBER() OVER( PARTITION BY PatientID, VisitType ORDER BY VisitDate) firstvisit
FROM #visit_info_table
),
RowsCTE AS(
SELECT *,
ROW_NUMBER() OVER(PARTITION BY PatientID ORDER BY VisitDate) rn
FROM FirstVisits
WHERE...
March 27, 2014 at 12:44 pm
mikesyd (3/27/2014)
March 27, 2014 at 12:08 pm
David Stout (3/27/2014)
March 27, 2014 at 10:47 am
robin.pryor (3/27/2014)
I'm a SQL DBA and I've never given a crap about schemas. I know what they...
March 27, 2014 at 10:42 am
To be clear, both are ANSI compliant, just different versions. The first is the SQL-92 and the second one is SQL-86.
As a best practice I would suggest that you follow...
March 27, 2014 at 10:28 am
ANSI_NULLS OFF is on deprecation list, so even if you can set it that way, is a good thing to avoid it.
And regarding the explanation, using ISNULL() on the WHERE...
March 27, 2014 at 10:03 am
Welcome to another fun story sponsored by our "DBAs?".
Last night, about 1:30am someone decided it was a good time to disable xp_cmdshell. I'm sure that person read somewhere that disabling...
March 27, 2014 at 9:54 am
Trying to explain the logic, I found there was a mistake when the first day of a month is Sunday. If you grab a calendar, it becomes evident. From Tuesday...
March 27, 2014 at 9:43 am
Have you tried the import/export wizard? You could use it to create the SSIS package and review it to make sure your destination has the correct structure.
March 27, 2014 at 9:28 am
Koen Verbeeck (3/27/2014)
W00t w00t, this one makes my 12000th point. 😎
Congratulations Koen!
March 27, 2014 at 9:25 am
priestxandar (3/26/2014)
@SSCrazyThanks for explanation this was extremely helpful, couldn't find and ask for better explanation, thanks again you are awesome bro, great example!
Thank you for the feedback. It's important that...
March 26, 2014 at 5:40 pm
You could change the value in the order by to get the desired row for each group.
March 26, 2014 at 3:14 pm
This is what I understood from your requirement. I agree with Sean and John that you need to post more details. Along with the solution, there's DDL and sample data,...
March 26, 2014 at 2:30 pm
Be careful when using ISNUMERIC, it can give you unexpected results.
March 26, 2014 at 11:30 am
Viewing 15 posts - 6,661 through 6,675 (of 8,731 total)