Community
    • Login

    Formating SQL syntax when pasting from MS Access

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    2 Posts 2 Posters 2.5k Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Bacel YounanB Offline
      Bacel Younan
      last edited by

      Newbie here - please bear with me. When I paste SQL into Notepad++, I would like to find a way to have it formatted into a syntax that’s easy to read for me as I’m not yet comfortable in SQL. Basically, not only to highlight certain syntax (like what the style configurator does) but also to split lines so they’re easier to read for me. Here’s an example:

      FROM THIS FORMAT
      SELECT SATURN_SFRSTCR.SFRSTCR_PIDM AS PIDM, SATURN_SFRSTCR.SFRSTCR_TERM_CODE AS TERM, …
      FROM (((((SATURN_SFRSTCR INNER JOIN SATURN_STVRSTS ON SATURN_SFRSTCR.SFRSTCR_RSTS_CODE = SATURN_STVRSTS.STVRSTS_CODE) INNER JOIN CAPMGR_SZVTRMC ON (CAPMGR_SZVTRMC.SZVTRMC_TERM_CODE = SATURN_SFRSTCR.SFRSTCR_TERM_CODE) AND (SATURN_SFRSTCR.SFRSTCR_PIDM = CAPMGR_SZVTRMC.SZVTRMC_PIDM)) INNER JOIN SATURN_SMRPRLE GROUP BY SATURN_SFRSTCR.SFRSTCR_PIDM, SATURN_SFRSTCR.SFRSTCR_TERM_CODE, SATURN_SPRIDEN.SPRIDEN_ID, SATURN_SPRIDEN.SPRIDEN_LAST_NAME, …
      HAVING (((SATURN_SFRSTCR.SFRSTCR_TERM_CODE)=“201710”) AND ((SATURN_SPRIDEN.SPRIDEN_CHANGE_IND) Is Null) AND ((GENERAL_GOREMAL.GOREMAL_EMAL_CODE)=“PERS”) AND …
      ORDER BY SATURN_SFRSTCR.SFRSTCR_PIDM;

      TO SOMETHING LIKE THIS FORMAT
      SELECT
      SATURN_SFRSTCR.SFRSTCR_PIDM AS PIDM,
      SATURN_SFRSTCR.SFRSTCR_TERM_CODE AS TERM, …

      FROM
      (((((SATURN_SFRSTCR INNER JOIN SATURN_STVRSTS ON SATURN_SFRSTCR.SFRSTCR_RSTS_CODE = SATURN_STVRSTS.STVRSTS_CODE) INNER JOIN CAPMGR_SZVTRMC ON (CAPMGR_SZVTRMC.SZVTRMC_TERM_CODE = SATURN_SFRSTCR.SFRSTCR_TERM_CODE) AND
      (SATURN_SFRSTCR.SFRSTCR_PIDM = CAPMGR_SZVTRMC.SZVTRMC_PIDM)) INNER JOIN SATURN_SMRPRLE GROUP BY SATURN_SFRSTCR.SFRSTCR_PIDM, SATURN_SFRSTCR.SFRSTCR_TERM_CODE, SATURN_SPRIDEN.SPRIDEN_ID, SATURN_SPRIDEN.SPRIDEN_LAST_NAME, …

      HAVING
      (((SATURN_SFRSTCR.SFRSTCR_TERM_CODE)=“201710”) AND
      ((SATURN_SPRIDEN.SPRIDEN_CHANGE_IND) Is Null) AND
      ((GENERAL_GOREMAL.GOREMAL_EMAL_CODE)=“PERS”) AND …

      ORDER BY SATURN_SFRSTCR.SFRSTCR_PIDM;

      Any help would be appreciated.
      Cheers. Bass

      Claudia FrankC 1 Reply Last reply Reply Quote 0
      • Claudia FrankC Offline
        Claudia Frank @Bacel Younan
        last edited by Claudia Frank

        @Bacel-Younan

        did you try @Guido-Thelen s SQL Formatter?

        Cheers
        Claudia

        1 Reply Last reply Reply Quote 0

        Hello! It looks like you're interested in this conversation, but you don't have an account yet.

        Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

        With your input, this post could be even better 💗

        Register Login
        • First post
          Last post
        The Community of users of the Notepad++ text editor.
        Powered by NodeBB | Contributors