Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

MSSQL JSON key value

/*create table ProductAttributes (
    product int,
    attribute varchar(40),
    value varchar(40)
)
insert into ProductAttributes select 1, 'color', 'red'
insert into ProductAttributes select 1, 'size', 'small'
insert into ProductAttributes select 2, 'processor', 'intel'
insert into ProductAttributes select 2, 'ram', '16'
insert into ProductAttributes select 2, 'weight', '2'*/

select 
    product, '{' + STRING_AGG( '"' + attribute + '":"' + STRING_ESCAPE(value,'json') + '"' ,',') + '}' as attributes
from ProductAttributes 
group by product
Comment

PREVIOUS NEXT
Code Example
Javascript :: localstorage getitem 
Javascript :: How do I access a class without an instance? +javascript 
Javascript :: js insert in array 
Javascript :: sort array in ascending javascript 
Javascript :: toast notification angular bootstrap 8 
Javascript :: js reverse 
Javascript :: filepond remove file after upload 
Javascript :: correct way to push into state array 
Javascript :: how to edit a fil with vanilla js 
Javascript :: react native layout animation android 
Javascript :: javascript add fields dynamically 
Javascript :: jquery owl go to slide 
Javascript :: how to wait till jquery post request has been made 
Javascript :: Backbone Router 
Javascript :: what is express static 
Javascript :: JS cast a Number into a String 
Javascript :: alpine js x-on click not working 
Javascript :: multiple ternary operator javascript 
Javascript :: node.js http server 
Javascript :: math module js 
Javascript :: react switch case 
Javascript :: cy.contains 
Javascript :: bootstrap and masonry 
Javascript :: Find index using arrow function 
Javascript :: difference between js and jsx 
Javascript :: joining array of string 
Javascript :: what to use let vs var js 
Javascript :: create owl component react js 
Javascript :: amcharts 
Javascript :: strict type javascript 
ADD CONTENT
Topic
Content
Source link
Name
4+3 =