Solved

Line up function returned string...

Posted on 2014-10-13
2
112 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 33

Author Closing Comment

by:Mike Eghtebas
ID: 40379176
Thank you.
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
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.
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

707 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now