Before just read about the addition of the percent feature in SQL Server 2008, today finally has the opportunity to try!
The data processed today, the top let the change, the marketing result of the value of NULL 20% instead of "failed", 80% to "reject". So I thought of percent:
First use the next select top percent from xxxtable where marketing results is NULL, success!
Update Ah, update top percent xxxtable Set marketing result = ' failed ' where marketing result is null; execution error, Halo! The original UPDATE statement 20 is to be bracketed.
Instead: Update top percent xxxtable Set marketing result = ' failed ' where marketing result is null
and try the top (percent), also can. Do not bother to check the official documents, can succeed on the line!
When querying the value of NULL, you can use the IsNull () function to determine the value of NULL and replace, has been used, just used to be confused with Nullif! The handling of null values is necessary to know!
The NULLIF function determines whether two strings are equal, returns a null value equal, and returns the value of the first string, not equal