Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to add a column placeholder allow NULL
Message
De
16/07/2012 10:45:03
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 9 SP1
Divers
Thread ID:
01536981
Message ID:
01548655
Vues:
42
J'aime (1)
>>>>>>What is wrong with CAST(null as int)? Why the Coalesce is necessary?
>>>>>
>>>>>Because he wanted to get 0 as the field's value, I assume.
>>>>
>>>>CAST() set the field nullable.
>>>>
>>>>select CAST(0 as int) as NewColumn
>>>>into #NewTable
>>>>
>>>>insert into #NewTable values (null)
>>>>select * from #NewTable 
>>>>
>>>
>>>No, CAST alone does not work when I need to select from another table, e.g.
>>>
>>>select CAST(cost as money) as cost
>>>into #newtable
>>>from myOtherTable
>>>
>>>does not work.
>>
>>sure ?
>>
>>
>>CREATE TABLE #myOtherTable (cost money not null)
>>
>>select CAST(cost as money) as cost
>>into #newtable
>>from #myOtherTable
>>
>>INSERT into #newtable VALUES (NULL)
>>
>>SELECT * FROM #newtable
>>
>>DROP TABLE #myOtherTable
>>DROP TABLE #newtable
>>
>
>Hmm, yesterday something similar didn't work in my tests, so I resorted to coalesce trick.

CAST() do the job. Your's test is bad somewhere. I'm sure.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform