Solved

Line up function returned string...

Posted on 2014-10-13
2
123 Views
Last Modified: 2014-10-13
The sql below returns something like:

Jack Smith            <-- has orders
Robert Nissan           <-- has orders

(in a combo box)

I want to line up <-- has orders portions in:

       SQL.ExecQuery("SELECT CustomerID, FirstName + ' ' + LastName + '     ' +" &
                     " dbo.fnHasOrders (CustomerID) as CustName From tblCustomers")


by having variable number of blank spaces instead of just '     ' above.

Let's say if we start this string (<-- has orders) at 50th position. I know it possibly will not to be exactly in line but it will be good enough.
0
Comment
Question by:Mike Eghtebas
2 Comments
 
LVL 15

Accepted Solution

by:
Haris Djulic earned 500 total points
ID: 40379157
You can try like this :

 SQL.ExecQuery("SELECT CustomerID, substring(FirstName + ' ' + LastName + '                                                     ',1,50) +" &
                     " dbo.fnHasOrders (CustomerID) as CustName From tblCustomers") 

Open in new window


Basically, you add up extra blanks and then you substing it to 50 places..
0
 
LVL 34

Author Closing Comment

by:Mike Eghtebas
ID: 40379176
Thank you.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question