Select spaces and then the value???
-
Hi, how (if at all) is it possible to do something like this... I want to select a column value from the database but i want to make sure that what i select, has a fixed length with spaces in the front of it if it is to short... example.
....Test1 .....Test .LongTest
Each "." represents a space. (so the select statement should be something like:SELECT (BlankSpace for x amount... where x amount would be (in my example: 9) - Len(TestColumnValue) + TestColumnValue)
) This will ensure that the selected values are right aligned and all the same length... :doh: Is this possible and how if it is? I hope i explained what i need clearly... please let me know if you need more info. Thank you in advance."Many of life's failures are people who did not realize how close they were to success when they gave up." Thomas A. Edison
-
Hi, how (if at all) is it possible to do something like this... I want to select a column value from the database but i want to make sure that what i select, has a fixed length with spaces in the front of it if it is to short... example.
....Test1 .....Test .LongTest
Each "." represents a space. (so the select statement should be something like:SELECT (BlankSpace for x amount... where x amount would be (in my example: 9) - Len(TestColumnValue) + TestColumnValue)
) This will ensure that the selected values are right aligned and all the same length... :doh: Is this possible and how if it is? I hope i explained what i need clearly... please let me know if you need more info. Thank you in advance."Many of life's failures are people who did not realize how close they were to success when they gave up." Thomas A. Edison
hi try this select right(space(20) + rtrim(FIELDNAME), 20) from TABLENAME Regards Joe
-
hi try this select right(space(20) + rtrim(FIELDNAME), 20) from TABLENAME Regards Joe
thank you... this looks promissing. I am playing around with this now. thank you for your time :-D
"Many of life's failures are people who did not realize how close they were to success when they gave up." Thomas A. Edison
-
Hi, how (if at all) is it possible to do something like this... I want to select a column value from the database but i want to make sure that what i select, has a fixed length with spaces in the front of it if it is to short... example.
....Test1 .....Test .LongTest
Each "." represents a space. (so the select statement should be something like:SELECT (BlankSpace for x amount... where x amount would be (in my example: 9) - Len(TestColumnValue) + TestColumnValue)
) This will ensure that the selected values are right aligned and all the same length... :doh: Is this possible and how if it is? I hope i explained what i need clearly... please let me know if you need more info. Thank you in advance."Many of life's failures are people who did not realize how close they were to success when they gave up." Thomas A. Edison
I believe this was already dealt over here[^]
Once you have mastered the ability to turn yourself invisible at will, and to deflect bullets with your hair, you will be ready to come back here to the lounge and post programming questions.Only at this point will you be able to dodge the fireballs that are going to come your way. - Pete O'Hanlon
-
I believe this was already dealt over here[^]
Once you have mastered the ability to turn yourself invisible at will, and to deflect bullets with your hair, you will be ready to come back here to the lounge and post programming questions.Only at this point will you be able to dodge the fireballs that are going to come your way. - Pete O'Hanlon
i though i had it figured out too... But now with the space() function... i can get the result i am looking for without using variables. Thank you for your time
"Many of life's failures are people who did not realize how close they were to success when they gave up." Thomas A. Edison
-
I believe this was already dealt over here[^]
Once you have mastered the ability to turn yourself invisible at will, and to deflect bullets with your hair, you will be ready to come back here to the lounge and post programming questions.Only at this point will you be able to dodge the fireballs that are going to come your way. - Pete O'Hanlon
Sorry.... But what does the
right(
do (i usedselect right(space(20) + 'TEST', 25)
? i tested the also withselect left(space(20) + 'TEST', 25)
... i did not notice a difference. What does the left or right do in this section?"Many of life's failures are people who did not realize how close they were to success when they gave up." Thomas A. Edison
-
Hi, how (if at all) is it possible to do something like this... I want to select a column value from the database but i want to make sure that what i select, has a fixed length with spaces in the front of it if it is to short... example.
....Test1 .....Test .LongTest
Each "." represents a space. (so the select statement should be something like:SELECT (BlankSpace for x amount... where x amount would be (in my example: 9) - Len(TestColumnValue) + TestColumnValue)
) This will ensure that the selected values are right aligned and all the same length... :doh: Is this possible and how if it is? I hope i explained what i need clearly... please let me know if you need more info. Thank you in advance."Many of life's failures are people who did not realize how close they were to success when they gave up." Thomas A. Edison
select replicate('.', 9 - len(ltrim(rtrim(TestColumnValue)))) + ltrim(rtrim(TestColumnValue))
from YourTableand this will left prefix with '.' character your field.
Nuclear launch detected