Comments (3)
Can you provide the query that you trying to format ?
from prettier-sql.
(Sorry for all the edits you're probably getting emailed. I missed the preview tab initially.)
Any of our stored procedures I try to format with the formatter set to inferrinizzard.prettier-sql-vscode pops up the notification...
Unable to format SQL: TypeError: Cannot read properties of undefined (reading 'value')
Source: Prettier SQL VSCode (Extension)
Here's an example with company specific names removed.
USE [TestDB]
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE type = 'P' AND name = 'TestProc')
BEGIN
exec('CREATE PROCEDURE [dbo].[TestProc] AS BEGIN SET NOCOUNT ON END;');
IF SUSER_NAME() != 'testuser' BEGIN
GRANT EXECUTE ON dbo.TestProc TO testuser;
END
END
GO
ALTER PROCEDURE [dbo].[TestProc]
AS BEGIN
SET NOCOUNT ON;
declare @batchsize int = 5000
,@timestamp varchar(33)
,@totalrows int = 0
,@rowcnt int = 0;
select @rowcnt = 1, @totalrows = 0;
while (@rowcnt > 0)
begin
delete top (@batchsize) testalias
from dbo.TestTable testalias
where testalias.TestDtField < dateadd(day, -31, getutcdate())
set @rowcnt = @@ROWCOUNT;
set @totalrows = @totalrows + @rowcnt;
waitfor delay '00:00:00.5'
end
set @timestamp = convert(varchar(33), getutcdate(), 126);
raiserror ('%s: %i entries deleted', 0, 1, @timestamp, @totalrows) with nowait
END
GO
It did, however, work with a very simple SQL statement:
select * from dbo.TestTable where TestTable.TestDTField > dateadd(day, -7, getutcdate());
->
SELECT *
FROM dbo.TestTable
WHERE
TestTable.TestDTField > dateadd(DAY, -7, getutcdate());
from prettier-sql.
Oh. Crap. I just saw on the home page/readme that it doesn't support stored procedures. I'll give some others a try. Sorry to waste your time on this.
from prettier-sql.
Related Issues (20)
- Feature Request: support `.prettierrc` config file HOT 1
- add clickhouse parser to your project
- support merge query HOT 2
- issue in clickhouse sql format . HOT 1
- [FORMATTING] Wrong alignment of 'DELETE' when keywordPosition="tenSpaceRight" HOT 1
- [FORMATTING] CASE statements in SUM() HOT 4
- Release this extension on the Open VSX Registery
- Missing space/new line with DELIMITER
- Feature Request: Make it as plugin for prettier HOT 1
- Feature Request: Snowflake Flavour
- [FORMATTING] Prettier-SQL.aliasAS": "never" deletes valid AS from non-alias clauses
- [FORMATTING] AS is trimmed in CAST function HOT 1
- formatter remove as in clickhouse script !
- [SCRIPT] Unsupported Regex breaks the app in Safari HOT 3
- [FORMATTING] Space is inserted before bracket for Map keys with . and -
- The future of prettier-sql / sql-formatter HOT 28
- [VSCODE] Should Preserve the Space between OR and REPLACE SQL Keywords HOT 1
- [VSCODE] Not working with Format Selection and Format Selection With...
- [ARCHIVE] This Repository will be archived in favour of sql-formatter-org/sql-formatter HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from prettier-sql.