Set the field value of null to 0.0 (numeric) or '' (character type) or ''

xiaoxiao2021-03-06  50

- Use the SQL Server to bring it out of the paragrace database PUBS. The original price field type is Money, Notes field type is VARCHAR (200)

- General practice (the benefit is not only to zero, but also to any desired value):

SELECT TITLE, 'Price123' = Case When Price End, TYEN 0.0 Else Price End, Type, 'Notes123' = Case When Notes Is Null Then '' Else Notes Endfrom Pubs.dbo.titles

- General practice (only zero application only):

SELECT TITLE, ISNULL (Price, 0) As Price123, Type, ISNULL (Notes, 'Unnoted') as Notes123From Pubs.dbo.titles

转载请注明原文地址:https://www.9cbs.com/read-40669.html

New Post(0)