New code formatting checks

  • I enter this text first with some questions. Now I enter code

    CREATE TABLE Claim
    ( PharmNo VARCHAR(20)
    , ClaimNo VARCHAR(20)
    , ClaimDate date
    )
    GO
    INSERT dbo.Claim (PharmNo, ClaimNo, ClaimDate)
    VALUES ('ABC', '123', '2019-01-01'),
    ('ABC', '987', '2019-01-02'),
    ('DEF', '234', '2019-02-01'),
    ('HIJ', '343', '2019-03-01')
    GO
    SELECT a.*, b.*
    FROM Claim a
    INNER JOIN Claim b
    ON a.PharmNo = b.PharmNo
    AND a.ClaimDate < b.ClaimDate

    Below the code, I've entered this line.

  • Steve Jones - SSC Editor wrote:

    I enter this text first with some questions. Now I enter code

    CREATE TABLE Claim
    ( PharmNo VARCHAR(20)
    , ClaimNo VARCHAR(20)
    , ClaimDate date
    )
    GO
    INSERT dbo.Claim (PharmNo, ClaimNo, ClaimDate)
    VALUES ('ABC', '123', '2019-01-01'),
    ('ABC', '987', '2019-01-02'),
    ('DEF', '234', '2019-02-01'),
    ('HIJ', '343', '2019-03-01')
    GO
    SELECT a.*, b.*
    FROM Claim a
    INNER JOIN Claim b
    ON a.PharmNo = b.PharmNo
    AND a.ClaimDate < b.ClaimDate

    Below the code, I've entered this line.

    Everything above this is quoted.

  • Let's check wide code in this post.

    INSERT dbo.Claim (PharmNo, ClaimNo, ClaimDate)   VALUES ('ABC', '123', '2019-01-01'), ('ABC', '987', '2019-01-02'), ('DEF', '234', '2019-02-01'), ('HIJ', '343', '2019-03-01')
    GO
    SELECT a.*, b.* FROM Claim a INNER JOIN Claim b ON a.PharmNo = b.PharmNo AND a.ClaimDate < b.ClaimDate

    This appears to scroll.

  • Steve Jones - SSC Editor wrote:

    Let's check wide code in this post.

    INSERT dbo.Claim (PharmNo, ClaimNo, ClaimDate)   VALUES ('ABC', '123', '2019-01-01'), ('ABC', '987', '2019-01-02'), ('DEF', '234', '2019-02-01'), ('HIJ', '343', '2019-03-01')
    GO
    SELECT a.*, b.* FROM Claim a INNER JOIN Claim b ON a.PharmNo = b.PharmNo AND a.ClaimDate < b.ClaimDate

    This appears to scroll.

    The scrolling works, which is a good thing.

    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
  • Luis Cazares wrote:

    Steve Jones - SSC Editor wrote:

    Let's check wide code in this post.

    INSERT dbo.Claim (PharmNo, ClaimNo, ClaimDate)   VALUES ('ABC', '123', '2019-01-01'), ('ABC', '987', '2019-01-02'), ('DEF', '234', '2019-02-01'), ('HIJ', '343', '2019-03-01')
    GO
    SELECT a.*, b.* FROM Claim a INNER JOIN Claim b ON a.PharmNo = b.PharmNo AND a.ClaimDate < b.ClaimDate

    This appears to scroll.

    The scrolling works, which is a good thing.

    Quoting code seems to be failing. Thanks for working on this.

    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
  • Yeah, posted another note on the issue and reopened that code needs to be quoted.

  • Luis Cazares wrote:

    Luis Cazares wrote:

    Steve Jones - SSC Editor wrote:

    Let's check wide code in this post.

    INSERT dbo.Claim (PharmNo, ClaimNo, ClaimDate)   VALUES ('ABC', '123', '2019-01-01'), ('ABC', '987', '2019-01-02'), ('DEF', '234', '2019-02-01'), ('HIJ', '343', '2019-03-01')
    GO
    SELECT a.*, b.* FROM Claim a INNER JOIN Claim b ON a.PharmNo = b.PharmNo AND a.ClaimDate < b.ClaimDate

    This appears to scroll.

    The scrolling works, which is a good thing.

    Quoting code seems to be failing. Thanks for working on this.

    Is the code quoted? It should be indented from this code:

    SELECT NumericValue = CAST(x.RecValue AS DECIMAL(17, 2))
    FROM
    (
    SELECT TOP 2147483647
    T1.RecValue
    FROM
    T1
    INNER JOIN T2
    ON T1.TypeId = T2.Id
    WHERE T2.ContentType = 'N'
    ) AS x
    WHERE CAST(x.RecValue AS DECIMAL(17, 2)) > 10;

    This should eb my last line of text

Viewing 7 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply