Register Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools
  #1  
Old 17 Mar 2011, 01:46
kronnos kronnos is offline
 
Join Date: Apr 2006
SQl Syntax Help

Hi,

I wanted to set a certain text for a user profile filed if it is currently blank.
So i want to try something like

UPDATE userfield SET field5 = REPLACE(field5,'IF THIS IS BLANK','REPLACE WITH NEW TEXT');

I dont know what to use in "IF THIS IS BLANK" because if I leave that spot blank, nothing happened. So should I use NULL in that place or completely rewrite the line so it says not replace but set?

thanks!
Reply With Quote
  #2  
Old 24 Mar 2011, 17:10
OcR Envy's Avatar
OcR Envy OcR Envy is offline
 
Join Date: May 2008
Real name: Ryan
UPDATE userfield SET field5='Your Replacement Text' WHERE field5 = '';
Reply With Quote
  #3  
Old 08 Aug 2012, 12:39
kronnos kronnos is offline
 
Join Date: Apr 2006
Thanks! Its great!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


New To Site? Need Help?

All times are GMT. The time now is 08:32.

Layout Options | Width: Wide Color: