Files
sql-snippets/newCol-7d139776-36e1-44e4-98a4-7360ca60dc70.json
2025-07-07 09:09:23 +02:00

24 lines
643 B
JSON

{
"id": "7d139776-36e1-44e4-98a4-7360ca60dc70",
"prefix": "newCol",
"description": "add new column",
"body": "IF NOT EXISTS(SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = '$table$' AND TABLE_SCHEMA='$schema$' AND COLUMN_NAME = '$column$')\r\nBEGIN\r\n\tALTER TABLE $schema$.$table$ ADD $column$ $type$ NOT NULL;\r\nEND ",
"placeholders": [
{
"name": "schema",
"defaultValue": null
},
{
"name": "table",
"defaultValue": null
},
{
"name": "column",
"defaultValue": null
},
{
"name": "type",
"defaultValue": null
}
]
}