I use ms sql and i need to create a table with a array column of nvarchar. What is the correct query ?
You don't want an array column. You want a separate table (or perhaps a JSON/XML column, but I won't focus on that).
The normal method would be:
create table main (
main_id int identity primary key,
. . .
);
create table element (
element_id int identity primary key,
position int,
value varchar(255),
. . .
);
create table main_elements (
main_element_id int identity primary key,
main_id int references main(main_id),
element_id int references elements(element_id)
);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With