Created
March 20, 2022 13:44
-
-
Save imrexhuang/3715d6087e26f77577a1b5df937bb38b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--TSQL利用CASE WHEN處理欄位的NULL值 | |
SELECT 'new CustomersEntity("'+ [CustomerID] + '" , "' + [CompanyName] + '" , "' + [ContactName] + '" , "' + [ContactTitle] + '" , " ' + [Address] + '" , "' + [City] + '" , "' | |
+ CASE WHEN [Region] IS NULL THEN '' ELSE [Region] END + '" , "' | |
+ CASE WHEN [PostalCode] IS NULL THEN '' ELSE [PostalCode] END + '" , "' | |
+ [Country] + '" , "' + [Phone] + '" , "' | |
+ CASE WHEN [Fax] IS NULL THEN ' ' ELSE [Fax] END + '" ' --SQL結尾 | |
+');' | |
FROM [dbo].[Customers] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment