Solved

Line up function returned string...

Posted on 2014-10-13
2
125 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

How to leverage one TLS certificate to encrypt Microsoft SQL traffic and Remote Desktop Services, versus creating multiple tickets for the same server.
I have a large data set and a SSIS package. How can I load this file in multi threading?
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.

696 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