Created
March 29, 2021 14:12
-
-
Save palanisamym14/0b5d549c18d3bd0a743339a80ec5629a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[].map(itm=> ({...itm, column: itm.column.replace('msaRecord.', '').replace('msaData.','d_').replace('.', '_')})) | |
const data =[]; | |
let key = 'CREATE TABLE TABLE (', val = 'VALUES('; | |
data.forEach(itm=>{ | |
switch(itm.type){ | |
case 'string': | |
key += `${itm.column.toLocaleUpperCase()} VARCHAR(${itm.width}),`; | |
break; | |
case 'int': | |
key += `${itm.column.toLocaleUpperCase()} INT,`; | |
break; | |
default: | |
break; | |
} | |
val +=':'+itm.column+','; | |
}) | |
console.log(key+')'+val+')') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment