D
D
Drovosek012019-04-12 14:22:03
SQL
Drovosek01, 2019-04-12 14:22:03

How to format sql code in VS Code?

Hello.
I'm looking for a way / extension with which you can beautifully format sql code (preferably PostgreSQL). It is paramount that by a keyboard shortcut or through a command in Ctrl + Shift + P all service words are converted to uppercase.
For example, to have this code:

create table if not exists cities (id integer primary key, name varchar(255) not null);
select * from cities;

Became like this:
CREATE TABLE IF NOT EXISTS cities (id   INTEGER PRIMARY KEY, name VARCHAR(255) NOT NULL);
SELECT * FROM   cities;

Or like this:
CREATE TABLE IF NOT EXISTS cities
  (
      id   INTEGER PRIMARY KEY,
      name VARCHAR(255) NOT NULL
  );
SELECT *
FROM cities;

I tried several extensions, but did not find one that has this functionality.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
d-stream, 2019-04-12
@d-stream

RedGate seems to hang out in the available for VS
At least for SSMS it formats decently

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question