Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Converting to 'SQL Table' creates columns with 'IList<[varchar](50) NULL>' columns #7

Open
mackcoding opened this issue Jan 26, 2016 · 1 comment

Comments

@mackcoding
Copy link

Using the following JSON:
{ "command" : "testcommand", "data" : [ { "name" : "NameOfTheObject", "values" : { "Item1" : [ "Value1" ], "Item2" : [ "Value2" ], "Item3" : [ "Value3" ], "Item4" : [ "Value4" ], "Item5" : [ "Value5" ] } } ], "status" : "success" }

Incorrectly outputs the following SQL:

create table Values (
    [Id] [int] IDENTITY(1,1) NOT NULL,
    [Item1] IList<[varchar](50) NULL>,
    [Item2] IList<[varchar](50) NULL>,
    [Item3] IList<[varchar](50) NULL>,
    [Item4] IList<[varchar](50) NULL>,
    [Item5] IList<[varchar](50) NULL>,
CONSTRAINT [PK_Values] PRIMARY KEY CLUSTERED
   (
      [Id] asc
   )
)

The correct output should be:

create table Values (
    [Id] [int] IDENTITY(1,1) NO NULL,
    [Item1] [varchar](50) NULL,
    [Item2] [varchar](50) NULL,
    [Item3] [varchar](50) NULL,
    [Item4] [varchar](50) NULL,
    [Item5] [varchar](50) NULL,
CONSTRAINT [PK_Values] PRIMARY KEY CLUSTERED
   (
      [Id] asc
   )
)
@bladefist
Copy link
Owner

The issue is the List is an array of json objects, and not a varcar. I made the sql output formatter simply as a helper, I don't think it can ever be perfectly right. If you have another thought, I'd be happy to accept a PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants