#1
  1. No Profile Picture
    Registered User
    ASP Explorer (0 - 99 posts)

    Join Date
    Apr 2007
    Posts
    27
    Rep Power
    0

    Replace NULL value


    my select statement returns NULL as the value for one of my fields. how can i replace NULL with blank in my select statement?
  2. #2
  3. **Wanted Wizard**
    ASP Mastermind (5000+ posts)

    Join Date
    Apr 2006
    Location
    Who knows...
    Posts
    5,410
    Rep Power
    1337
    Originally Posted by pgmr1998
    my select statement returns NULL as the value for one of my fields. how can i replace NULL with blank in my select statement?
    Code:
    select replace(field_name,NULL,'') from tableA
    I would rather know than not know at all...


  4. #3
  5. No Profile Picture
    Registered User
    ASP Explorer (0 - 99 posts)

    Join Date
    Apr 2007
    Posts
    27
    Rep Power
    0
    Originally Posted by chapman10s
    Code:
    select replace(field_name,NULL,'') from tableA
    that statement actually puts NULL in every occurance of the field. am i doing something wrong?
  6. #4
  7. **Wanted Wizard**
    ASP Mastermind (5000+ posts)

    Join Date
    Apr 2006
    Location
    Who knows...
    Posts
    5,410
    Rep Power
    1337
    Originally Posted by chapman10s
    Code:
    select replace(field_name,NULL,'') from tableA

    Sorry...try this.

    Code:
    select replace(field_name,'',NULL) from tableA
    but my first suggestion should have worked. It would have changed all null values to ''
  8. #5
  9. No Profile Picture
    Registered User
    ASP Explorer (0 - 99 posts)

    Join Date
    Apr 2007
    Posts
    27
    Rep Power
    0
    Originally Posted by chapman10s
    Sorry...try this.

    Code:
    select replace(field_name,'',NULL) from tableA
    but my first suggestion should have worked. It would have changed all null values to ''
    i am trying to replace the value NULL with spaces or blanks for the selected field. here is my code:

    [CODE]select replace(PrjMgr,'',NULL) from dbo.LLA_Audits

    this code does not work. is there another function i can use?
  10. #6
  11. SQL Slarentice
    ASP Skiller (1500 - 1999 posts)

    Join Date
    Nov 2004
    Location
    In My Happy Place
    Posts
    1,843
    Rep Power
    1410
    Another way is to do this:
    Code:
     SELECT ISNULL(myTable.fieldA, '')
    I hope this helps!
  12. #7
  13. No Profile Picture
    Registered User
    ASP Explorer (0 - 99 posts)

    Join Date
    Apr 2007
    Posts
    27
    Rep Power
    0
    Originally Posted by Lauramc
    Another way is to do this:
    Code:
     SELECT ISNULL(myTable.fieldA, '')
    I hope this helps!
    that worked beautifully! thanks so much...

Similar Threads

  1. Query Error - Text Too Long
    By navkeshchawla in forum Microsoft Access Help
    Replies: 8
    Last Post: June 20th, 2006, 07:07 AM
  2. Updating rows
    By teeheiman in forum ASP Development
    Replies: 3
    Last Post: February 23rd, 2006, 06:10 PM
  3. Compare two tables
    By aish in forum Microsoft SQL Server
    Replies: 3
    Last Post: January 27th, 2006, 07:42 AM
  4. Addition Woes
    By Jackie W in forum ASP Development
    Replies: 19
    Last Post: April 29th, 2005, 12:30 PM
  5. ASP Problem When Posting To MySQL Database
    By wleguy in forum ASP Development
    Replies: 14
    Last Post: February 22nd, 2004, 11:49 AM

IMN logo majestic logo threadwatch logo seochat tools logo