Forum Replies Created

Viewing 15 posts - 6,661 through 6,675 (of 8,731 total)

  • RE: Help with Top Distinct 2 Records

    MyDoggieJessie (3/27/2014)


    Perhaps something like this?; 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...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Help with Top Distinct 2 Records

    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...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: What is (Null='Hello') in Sql Server

    mikesyd (3/27/2014)


    When and why would it be useful to have ANSI_NULLS on?? Something is either null or it isn't to me. Having the system say "I can't tell...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Simple Inner Join Question

    David Stout (3/27/2014)


    I do agree the first one is easyer to read. I was pulling some old code and ran into the second way of doing it and I could...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: I need differences between Roles, Schemas, Users and Logins. Can anyone help me. Thanks in advance

    robin.pryor (3/27/2014)


    Ah but the question "What landed me on this post in the 1st place?"

    I'm a SQL DBA and I've never given a crap about schemas. I know what they...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Simple Inner Join Question

    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...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: What is (Null='Hello') in Sql Server

    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...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Are the posted questions getting worse?

    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...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: How to get the date?

    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...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Need to migrate a databases from DB2 to SQL server

    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.

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Are the posted questions getting worse?

    Koen Verbeeck (3/27/2014)


    W00t w00t, this one makes my 12000th point. 😎

    Congratulations Koen!

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: rewrite cursor to set based

    priestxandar (3/26/2014)


    @SSCrazy

    Thanks 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...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: batch max date top

    You could change the value in the order by to get the desired row for each group.

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Need Help for the following problem

    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,...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Using "not like" to filter out non-numeric values from varchar field

    Be careful when using ISNUMERIC, it can give you unexpected results.

    http://www.sqlservercentral.com/articles/ISNUMERIC()/71512/

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2

Viewing 15 posts - 6,661 through 6,675 (of 8,731 total)