Forcing a Linefeed in SQL

Forcing a Linefeed in SQL

How do I force a linefeed character using SQL? I created a report (see below) but when I e-mailed this report from Unix the carriage return was not interpreted correctly.

I want the results to look like the following:

Invoice Number: 123456
Order Number: 444422222
Customer Number: abc123

When I e-mail this file using elm (to Microsoft Outlook or cc:Mail), I get the following :

Invoice Number: 123456 Order Number:44422222 Customer Number: abc123

The line break is not recognized. Any thoughts??

Here’s the code:

set verify offset echo offset feedback offset linesize 30set space 0set heading offcolumn invoice_num format  fold_after 1column sales_ord_num format  fold_after 1column rapid_txn_id format  fold_after 1column launch_dt format  fold_after 1column inv_dt format  fold_after 1spool &1select  'Invoice Number    :  &1' invoice_num,        'Sales Order Number:  ', sales_ord_num,        'RAPID Txn Number  :  ',  oh.mepr rapid_txn_id,        'Order Date        :  ', to_char(oh.timestamp,'MM/DD/YY') launch_dt,        'Ship Date         :  ', to_char(inv_dt,'MM/DD/YY') inv_dtfrom    sales_ord so, inv_hdr inv, ord_hdr ohwhere   so.sales_ord_id = inv.sales_ord_id

Hm, this looks like Oraclese… 🙂

I don’t know if this will work, but you might try sending a carriage return and line feed combination?like CHAR(10)+CHAR(13)?at the end of each column name. That may do it for you.

Share the Post:
XDR solutions

The Benefits of Using XDR Solutions

Cybercriminals constantly adapt their strategies, developing newer, more powerful, and intelligent ways to attack your network. Since security professionals must innovate as well, more conventional endpoint detection solutions have evolved

AI is revolutionizing fraud detection

How AI is Revolutionizing Fraud Detection

Artificial intelligence – commonly known as AI – means a form of technology with multiple uses. As a result, it has become extremely valuable to a number of businesses across

AI innovation

Companies Leading AI Innovation in 2023

Artificial intelligence (AI) has been transforming industries and revolutionizing business operations. AI’s potential to enhance efficiency and productivity has become crucial to many businesses. As we move into 2023, several

data fivetran pricing

Fivetran Pricing Explained

One of the biggest trends of the 21st century is the massive surge in analytics. Analytics is the process of utilizing data to drive future decision-making. With so much of

kubernetes logging

Kubernetes Logging: What You Need to Know

Kubernetes from Google is one of the most popular open-source and free container management solutions made to make managing and deploying applications easier. It has a solid architecture that makes

ransomware cyber attack

Why Is Ransomware Such a Major Threat?

One of the most significant cyber threats faced by modern organizations is a ransomware attack. Ransomware attacks have grown in both sophistication and frequency over the past few years, forcing

data dictionary

Tools You Need to Make a Data Dictionary

Data dictionaries are crucial for organizations of all sizes that deal with large amounts of data. they are centralized repositories of all the data in organizations, including metadata such as