Formatting for Synapse
I have started using Serverless SQL Pool within SSMS. I have seen and voted for a post for Intellisense, but it would be good to be able to format a query too. For example the below query:
SELECT cast(r.filepath(1) as varchar(100)) as [$FileName], ISNULL(SysRowId,0) AS _SysRowId, ISNULL(LSN,'') AS LSN, ISNULL(LastProcessedChangeDateTime,'1900-01-01') AS LastProcessedChangeDateTime, ISNULL(DataLakeModifiedDateTime,'1900-01-01') AS DataLakeModifiedDateTime, ISNULL(RECID,0) AS RECID, Language, Status, Stage, ISNULL(DataAreaId,'') AS DataAreaId, ISNULL(PARTITION,0) AS PARTITION, ISNULL(RECVERSION,0) AS RECVERSION
FROM OPENROWSET(BULK 'Tables/StgTable/*.csv'
,FORMAT = 'CSV', PARSERVERSION = '2.0', DATASOURCE ='wsds', ROWSETOPTIONS = '{"READOPTIONS":["ALLOWINCONSISTENTREADS"] }'
)
WITH (SysRowId bigInt, LSN nvarchar(60), LastProcessedChangeDateTime datetime2, DataLakeModifiedDateTime datetime2, RECID bigInt, Language nvarchar(7), Status int, Stage nvarchar(30), DataAreaId nvarchar(4), PARTITION bigInt, RECVERSION int) as r
When I try to format this, I get error messages in the output complaining of syntax errors.
![](https://secure.gravatar.com/avatar/9d17f8bfba3987166c0cbe7736b44f20?size=40&default=https%3A%2F%2Fassets.uvcdn.com%2Fpkg%2Fadmin%2Ficons%2Fuser_70-6bcf9e08938533adb9bac95c3e487cb2a6d4a32f890ca6fdc82e3072e0ea0368.png)