SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 how to set a field value to null
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Pasi
Posting Yak Master

146 Posts

Posted - 03/26/2014 :  19:35:44  Show Profile  Reply with Quote
HI,

I have a column called person.last_name, and I want to set this field to NULL if person.last_name ='test'
I have tried this but don't work:
ISNULL({person.last_name},'<>"test'))

Thanks!

Edited by - Pasi on 03/26/2014 19:36:50

nagino
Yak Posting Veteran

Japan
65 Posts

Posted - 03/26/2014 :  19:52:59  Show Profile  Reply with Quote
UPDATE person SET last_name = null WHERE last_name = 'test'

-------------------------------------
From Japan
Sorry, my English ability is limited.
Go to Top of Page

Pasi
Posting Yak Master

146 Posts

Posted - 03/26/2014 :  22:47:31  Show Profile  Reply with Quote
Thanks Nagino but this is not what I am looking for , I don't want to update or overwrite a table in sql I ma accessing the SQl from my app and want to write the formula to say if the column has "test" in it, ignore it or set it to null. looking for formula to do the condition for me.
Pasi
Go to Top of Page

khtan
In (Som, Ni, Yak)

Singapore
17587 Posts

Posted - 03/26/2014 :  23:14:23  Show Profile  Reply with Quote
NULLIF ( person.last_name , 'test' )



KH
Time is always against us

Go to Top of Page

Pasi
Posting Yak Master

146 Posts

Posted - 03/27/2014 :  01:16:36  Show Profile  Reply with Quote
Thanks! hope this works.
Go to Top of Page

khtan
In (Som, Ni, Yak)

Singapore
17587 Posts

Posted - 03/27/2014 :  01:26:15  Show Profile  Reply with Quote
keep your finger cross


KH
Time is always against us

Go to Top of Page

madhivanan
Premature Yak Congratulator

India
22744 Posts

Posted - 03/28/2014 :  06:04:56  Show Profile  Send madhivanan a Yahoo! Message  Reply with Quote
or


case when person.last_name = 'test' then NULL else person.last_name end


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

Pasi
Posting Yak Master

146 Posts

Posted - 04/02/2014 :  14:47:16  Show Profile  Reply with Quote
Thanks Madhivanan I will try that!
Pasi
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000