Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

update a null 2

Status
Not open for further replies.

oakpark5

Programmer
Sep 2, 2004
81
US
i think this is easy but it doesnt seem to work...

update artran set disc2 = '0' where disc2 = null

how do i enter the null value, 'null', '', nothing seems to work, thanks for the help.

Software Engineer
Team Lead
damn bill gates, he has everything
 
Did you try is null rather than = null? Also are you sure you have null values and not empty strings?

Questions about posting. See faq183-874
 
You can change a property of the column disc2 so that the default value is '0', that way future nulls won't accidentally get added.
-Karl

[red] Cursors, triggers, user-defined functions and dynamic SQL are an axis of evil![/red]
[green]Life's uncertain...eat dessert first...www.deerfieldbakery.com[/green]
 
thye are nulls, they say nulls in the fields,

so i tried this but it didnt work

update artran set disc2='0' where ISNULL(disc2)

i didnt think updating a null would be this difficult...

Software Engineer
Team Lead
damn bill gates, he has everything
 
It's difficult until you get the knack for SQL Server's syntax which isn't very user friendly.
Code:
[Blue]UPDATE[/Blue] artran [Blue]SET[/Blue] disc2[Gray]=[/Gray][red]'0'[/red] [Blue]WHERE[/Blue] disc2 [Blue]IS[/Blue] [Gray]NULL[/Gray]
-Karl

[red] Cursors, triggers, user-defined functions and dynamic SQL are an axis of evil![/red]
[green]Life's uncertain...eat dessert first...www.deerfieldbakery.com[/green]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top