troubleshooting Question

SQL field padding.

Avatar of jfsedlar3rd
jfsedlar3rdFlag for United States of America asked on
DatabasesMicrosoft SQL Server 2005SQL
2 Comments2 Solutions581 ViewsLast Modified:
I am writing a Transact sql query that will produce data for a fixed length flat file. Is there anyway to pad the data with the appropriate number of blank spaces in the query? I can handle this in code but would prefer to in the query if it is possible.

For example: There are 166 fields and the total character length per row must be 1600 not more or less. Some fields may have no data but must contain the right amount of padding or the field may have data such as 10 chars worth but the entire field length must be 20.

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 2 Answers and 2 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros