DECLARE Carriage Return

6 Posts
2 Users
0 Likes
190 Views
(@jonnygabble)
Member
Joined: 5 months ago
Posts: 3
Topic starter  

Return before DECLARE.  I am not sure if I am missing something, but I have DECLAREs as the beginning of my SQL.  When I format it it is removing the carriage return and forcing these all onto one line.  I have looked through the settings, but can't find anything to stop this from happening.  Am I missing something? 


   
Quote
Guido
(@admin)
Member Admin
Joined: 2 years ago
Posts: 175
 

Hi @jonnygabble, could you please post a code snippet and let me know which DB you have chosen in the General Tab?

Regards

Guido

This post was modified 5 months ago by Guido

   
ReplyQuote
(@jonnygabble)
Member
Joined: 5 months ago
Posts: 3
Topic starter  

I have chosen Azure as the database.  Here is an example of the SQL before and after formatting.

 

DECLARE @start_date DATE='04-01-2021'
DECLARE @end_date DATE='04-30-2021'
DECLARE @supplier INT=10486 --Enter Supplier Number

SELECT
invoice_hdr.invoice_no,
invoice_hdr.bill2_name
FROM oe_line
INNER JOIN invoice_hdr ON oe_line.order_no=invoice_hdr.order_no

WHERE
oe_line.supplier_id=@supplier
AND CAST(invoice_hdr.invoice_date AS DATE)>=@start_date
AND CAST(invoice_hdr.invoice_date AS DATE)<=@end_date

 

DECLARE @start_date DATE='04-01-2021' DECLARE @end_date DATE='04-30-2021' DECLARE @supplier INT=10486 --Enter Supplier Number

SELECT
invoice_hdr.invoice_no,
invoice_hdr.bill2_name
FROM oe_line
INNER JOIN invoice_hdr ON oe_line.order_no=invoice_hdr.order_no

WHERE
oe_line.supplier_id=@supplier
AND CAST(invoice_hdr.invoice_date AS DATE)>=@start_date
AND CAST(invoice_hdr.invoice_date AS DATE)<=@end_date


   
ReplyQuote
(@jonnygabble)
Member
Joined: 5 months ago
Posts: 3
Topic starter  

FYI, just tested this and if I choose SQL Server it works as I would like.


   
ReplyQuote
Guido
(@admin)
Member Admin
Joined: 2 years ago
Posts: 175
 

Hi @jonnygabble,

many thanks for your feedback. Will improve the Azure Parsing accordingly.

Regards

Guido


   
ReplyQuote
Guido
(@admin)
Member Admin
Joined: 2 years ago
Posts: 175
 

@jonnygabble 

in my testing environment it looks better now.

grafik

 


   
ReplyQuote
Share: