DECLARE Carriage Return

6 Posts
2 Users
0 Reactions
1,189 Views
Posts: 3
Topic starter
(@jonnygabble)
Member
Joined: 3 years ago
[#94]

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? 


5 Replies
Guido
Posts: 295
Admin
(@admin)
Member
Joined: 5 years ago

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

Regards

Guido


Reply
Posts: 3
Topic starter
(@jonnygabble)
Member
Joined: 3 years ago

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


Reply
Posts: 3
Topic starter
(@jonnygabble)
Member
Joined: 3 years ago

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


Reply
1 Reply
Guido
Admin
(@admin)
Joined: 5 years ago

Member
Posts: 295

@jonnygabble 

in my testing environment it looks better now.

grafik

 


Reply
Guido
Posts: 295
Admin
(@admin)
Member
Joined: 5 years ago

Hi @jonnygabble,

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

Regards

Guido


Reply
Share: