• If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Announcement

Collapse
No announcement yet.

NAB Data Source SQL Formatter VALUES clause

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • NAB Data Source SQL Formatter VALUES clause

    Valence version 6.3.20240821.0?

    I enter this SQL into the NAB Data Source editor:
    with
    fakeSubdivisions (subdivcode, subdivname) AS (
    VALUES
    ('001', 'Subdivision 001'),
    ('002', 'Subdivision 002'),
    ('003', 'Subdivision 003'),
    ('004', 'Subdivision 004'),
    ('005', 'Subdivision 005'),
    ('006', 'Subdivision 006')
    )
    SELECT *
    FROM fakeSubdivisions


    It transforms it into this:
    WITH fakesubdivisions(subdivcode, subdivname) AS (
    SELECT
    '001',
    'Subdivision 001',
    '002',
    'Subdivision 002',
    '003',
    'Subdivision 003',
    '004',
    'Subdivision 004',
    '005',
    'Subdivision 005',
    '006',
    'Subdivision 006'
    )
    SELECT
    *
    FROM
    fakesubdivisions
    ?
    There's other ways I can stub out some fake data, but a quick VALUES statement would be quite handy sometimes.
    As a side note, if you enter just the VALUES statement without the CTE, the formatter gets stuck trying to add aliases to the columns.

  • #2
    Thanks for letting us know, and we will take a look. I know the NAB parser/regenerator works just fine with something like this:

    Code:
    SELECT
      valuecol,
      displaycol
    FROM
      TABLE(
        VALUES
          ('A', 'Active'),
          ('D', 'Disabled'),
          ('H', 'Held')
      ) AS statusdata (valuecol, displaycol)

    Comment


    • #3
      Thanks Johnny!

      Comment


      • #4
        This will be supported in the next 6.3 update.

        Code:
        WITH fakesubdivisions(subdivcode, subdivname) AS (
          VALUES
            ('001', 'Subdivision 001'),
            ('002', 'Subdivision 002'),
            ('003', 'Subdivision 003'),
            ('004', 'Subdivision 004'),
            ('005', 'Subdivision 005'),
            ('006', 'Subdivision 006')
        )
        SELECT
          *
        FROM
          fakesubdivisions
        Last edited by Johnny Major; 10-06-2024, 01:48 PM.

        Comment

        Working...
        X