Notices

Great community. Great ideas.

Welcome to ASP/Free, a community dedicated to helping beginners and professionals alike in improving their knowledge of Microsoft's development and administration technologies. Sign up today to gain access to the combined insight of tens of thousands of members.

Thread: Replace NULL value

Results 1 to 7 of 7
Share This Thread →
  1. #1
    pgmr1998 is offline Registered User
    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
    chapman10s's Avatar
    chapman10s is offline **Wanted Wizard**
    Join Date
    Apr 2006
    Location
    Who knows...
    Posts
    5,410
    Rep Power
    1337
    Quote 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...



  3. #3
    pgmr1998 is offline Registered User
    Join Date
    Apr 2007
    Posts
    27
    Rep Power
    0
    Quote 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?

  4. #4
    chapman10s's Avatar
    chapman10s is offline **Wanted Wizard**
    Join Date
    Apr 2006
    Location
    Who knows...
    Posts
    5,410
    Rep Power
    1337
    Quote 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 ''

  5. #5
    pgmr1998 is offline Registered User
    Join Date
    Apr 2007
    Posts
    27
    Rep Power
    0
    Quote 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?

  6. #6
    Lauramc's Avatar
    Lauramc is offline SQL Slarentice
    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!

  7. #7
    pgmr1998 is offline Registered User
    Join Date
    Apr 2007
    Posts
    27
    Rep Power
    0
    Quote 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...

Share This Thread →

Become Part of This Conversation

Join NowFor Free!

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

ASP Free Advertisers and Affiliates