Reputation: 19
I am trying to create a computed column in SQL Server Management Studio off of a bit column but it keeps erroring out stating "Erro Validating the formula for column..."
I have tried the following:
CASE WHEN AribaSupplier_PotentialforCatalogFlag=1 THEN "True" ELSE "False" END
CASE WHEN AribaSupplier_PotentialforCatalogFlag='1' THEN "True" ELSE "False" END
CASE WHEN AribaSupplier_PotentialforCatalogFlag=True THEN "True" ELSE "False" END
CASE WHEN AribaSupplier_PotentialforCatalogFlag='True' THEN "True" ELSE "False" END
Upvotes: 0
Views: 74
Reputation: 164089
Since this is SQL Server, there is IIF():
IIF(AribaSupplier_PotentialforCatalogFlag = 1, 'True', 'False')
Upvotes: 1
Reputation: 50163
You need single quote for string constant :
(CASE WHEN AribaSupplier_PotentialforCatalogFlag = 1
THEN 'true' ELSE 'false'
WHEN AribaSupplier_PotentialforCatalogFlag = 'True'
THEN 'True' ELSE 'False'
END)
Upvotes: 0
Reputation: 1269623
String constants should be in single quotes, not double quotes. So try:
CASE WHEN AribaSupplier_PotentialforCatalogFlag = 1 THEN 'True' ELSE 'False' END
Upvotes: 3