SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Hybrid View

  1. #1
    SitePoint Member
    Join Date
    Jul 2001
    0 Post(s)
    0 Thread(s)

    Format Problem with MS-SQL

    I am somewhat experienced using Access Databases in ASP, and I am developing a larger scale script that will require a MS-SQL Database. I have everything set up properly and I am able to load data from my database into an ASP page, but when I do, it seems that the data has an extra space after the last character. So when I try to include a piece of data into a url it adds an extra space and comes up as a broken link.

    I've checked and double checked by data, and there are no spaces at the end of any of the data I input, nor do I have an extra space in my code. I never experienced this problem using Access, does any one know why MS-SQL is doing this to me, and how I can get around it? Any help would be appreciated! Thanks!

  2. #2
    SitePoint Addict danfran's Avatar
    Join Date
    Jan 2005
    New York City
    0 Post(s)
    0 Thread(s)

    In SQL Server, you have the fields defined as nchar or char. (These store fixed-length pieces of data, including (and especially) trailing space characters..

    In table design mode, from Enterprise Manager, change the fields to varchar or nvarchar.

    Did you use the migration wizard?


    Also, you'll have to update your existing data..
    update table set [col] = ltrim(rtrim([col]))
    Last edited by danfran; Feb 8, 2005 at 08:12.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts