Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TSQL: wrong indent for IF ... THROW if BEGIN...END is not used #266

Open
aisbergde opened this issue Jan 25, 2021 · 0 comments
Open

TSQL: wrong indent for IF ... THROW if BEGIN...END is not used #266

aisbergde opened this issue Jan 25, 2021 · 0 comments

Comments

@aisbergde
Copy link

Ty to format some TSQL containing IF and THROW, you get this wrong result with unwanted indents

IF @persistence_name_suffix IS NULL THROW 51001
 , '@persistence_name_suffix is null'
 , 1;
 IF @source_RepoObject_guid IS NULL
  AND @persistence_RepoObject_guid IS NULL THROW 51002
  , '@source_RepoObject_guid is null and @persistence_RepoObject_guid is null'
  , 1;
  IF NOT @persistence_RepoObject_guid IS NULL
   AND @source_RepoObject_guid IS NULL
  BEGIN
   SELECT 1
  END

this is the documentation for THROW
https://docs.microsoft.com/de-de/sql/t-sql/language-elements/throw-transact-sql?view=sql-server-ver15

A line break before THROW would be fine

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant