Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. right align

right align

Scheduled Pinned Locked Moved Database
databasehelpquestion
6 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Support123
    wrote on last edited by
    #1

    Hi, Can you set a column to store data right aligned? (the reason i want to know this is because all our values are set to char() datatype in SQL database. This will mean that the left out characters / the character that are short will be filled in with blank spaces. Having the value right aligned will mean that the spaces will be put in front of the value and not at the back and that is what i am looking for (if this is possible).) OR is there a way to select the values from the database as right aligned (i will be using the REPLACE(TheRecordFromTheTable, ' ','') , this will help to remove the added spaces from the back due to char() datatype.) 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

    J J K C 4 Replies Last reply
    0
    • S Support123

      Hi, Can you set a column to store data right aligned? (the reason i want to know this is because all our values are set to char() datatype in SQL database. This will mean that the left out characters / the character that are short will be filled in with blank spaces. Having the value right aligned will mean that the spaces will be put in front of the value and not at the back and that is what i am looking for (if this is possible).) OR is there a way to select the values from the database as right aligned (i will be using the REPLACE(TheRecordFromTheTable, ' ','') , this will help to remove the added spaces from the back due to char() datatype.) 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

      J Offline
      J Offline
      joemonvarghese
      wrote on last edited by
      #2

      hi plz clarify your question... Regards Joe

      1 Reply Last reply
      0
      • S Support123

        Hi, Can you set a column to store data right aligned? (the reason i want to know this is because all our values are set to char() datatype in SQL database. This will mean that the left out characters / the character that are short will be filled in with blank spaces. Having the value right aligned will mean that the spaces will be put in front of the value and not at the back and that is what i am looking for (if this is possible).) OR is there a way to select the values from the database as right aligned (i will be using the REPLACE(TheRecordFromTheTable, ' ','') , this will help to remove the added spaces from the back due to char() datatype.) 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

        J Offline
        J Offline
        Joe 2
        wrote on last edited by
        #3

        Support123 wrote:

        is there a way to select the values from the database as right aligned

        May I know what is your objective in doing so?

        1 Reply Last reply
        0
        • S Support123

          Hi, Can you set a column to store data right aligned? (the reason i want to know this is because all our values are set to char() datatype in SQL database. This will mean that the left out characters / the character that are short will be filled in with blank spaces. Having the value right aligned will mean that the spaces will be put in front of the value and not at the back and that is what i am looking for (if this is possible).) OR is there a way to select the values from the database as right aligned (i will be using the REPLACE(TheRecordFromTheTable, ' ','') , this will help to remove the added spaces from the back due to char() datatype.) 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

          K Offline
          K Offline
          Krish KP
          wrote on last edited by
          #4

          Is this what you are trying declare @a char(20) set @a = 'testing' select right(space(20) + rtrim(@a), 20) 1. Removing spaces at end 2. Adding at the begining 3. Ignoring extra spaces from begining

          Regards KP

          1 Reply Last reply
          0
          • S Support123

            Hi, Can you set a column to store data right aligned? (the reason i want to know this is because all our values are set to char() datatype in SQL database. This will mean that the left out characters / the character that are short will be filled in with blank spaces. Having the value right aligned will mean that the spaces will be put in front of the value and not at the back and that is what i am looking for (if this is possible).) OR is there a way to select the values from the database as right aligned (i will be using the REPLACE(TheRecordFromTheTable, ' ','') , this will help to remove the added spaces from the back due to char() datatype.) 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

            C Offline
            C Offline
            ChandraRam
            wrote on last edited by
            #5

            Support123 wrote:

            Can you set a column to store data right aligned? (the reason i want to know this is because all our values are set to char() datatype in SQL database. This will mean that the left out characters / the character that are short will be filled in with blank spaces. Having the value right aligned will mean that the spaces will be put in front of the value and not at the back and that is what i am looking for (if this is possible).) OR is there a way to select the values from the database as right aligned (i will be using the REPLACE(TheRecordFromTheTable, ' ','') , this will help to remove the added spaces from the back due to char() datatype.)

            Is there a particular reason why you are storing numbers as strings? Wouldn't storing numbers as binary fields be more efficient?

            S 1 Reply Last reply
            0
            • C ChandraRam

              Support123 wrote:

              Can you set a column to store data right aligned? (the reason i want to know this is because all our values are set to char() datatype in SQL database. This will mean that the left out characters / the character that are short will be filled in with blank spaces. Having the value right aligned will mean that the spaces will be put in front of the value and not at the back and that is what i am looking for (if this is possible).) OR is there a way to select the values from the database as right aligned (i will be using the REPLACE(TheRecordFromTheTable, ' ','') , this will help to remove the added spaces from the back due to char() datatype.)

              Is there a particular reason why you are storing numbers as strings? Wouldn't storing numbers as binary fields be more efficient?

              S Offline
              S Offline
              Support123
              wrote on last edited by
              #6

              Thank all of you... BUT never mind... i found a way around my problem... sorry for stating my question so unclear. I wasn't even sure what i needed. What i wanted to do is add the spaces in front of some of the Values in the database. This is then easier when i have to populate the flatfile using ssis package. (The reason why i store the numbers as CHAR() is just a staging table. Easier to get the fixed length right :) ) Thank you all once again for the effort.

              "Many of life's failures are people who did not realize how close they were to success when they gave up." Thomas A. Edison

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups