Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Incorporate a parameter into a script
Message
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
01676759
Message ID:
01676767
Vues:
38
Thank you for explaining what was missing in my expression.

>if you do Textmerge you need to realize that the string is parsed literally. Therefore the correct usage of inline Textmerge would be:
>
>ALTER TABLE <<tcTableName>> ALTER COLUMN <<tcFieldName>> varchar(max) <<iif(tlNull, 'NOT NULL', 'NULL')>>
>
>
>>UPDATE. Found solution. Simply store the value into a variable.
>>
>>cNullValue = 'NOT NULL'
>>ALTER TABLE <<tcTableName>> ALTER COLUMN <<tcFieldName>> varchar(max) <<cNullValue>>
>>
>>Works.
>>
>>Hi,
>>
>>I created a procedure in my VFP 9 program that changes the column of the SQL Server DB from Text to Varchar(max) (Thanks to Borislav Borissov!). It works.
>>I am trying to make this procedure more generic so that it receives a parameter indicating if the column should allow NULL or not.
>>Instead of writing two scripts, I would like to incorporate the passed parameter into the VFP code. Here is the snippet of the code:
>>
>>lparameter tlNull   && .F. to not to allow null.  .T. to allow NULL
>>ALTER TABLE <<tcTableName>> ALTER COLUMN <<tcFieldName>> varchar(max) NOT NULL
>>
>>The code above is for NOT NULL only. How do I change the NOT NULL to use the Parameter tlNull?
>>
>>This is what I tried:
>>
>>ALTER TABLE <<tcTableName>> ALTER COLUMN <<tcFieldName>> varchar(max) <<iif(tlNull, NOT NULL, NULL)>>
>>
>>
>>But the above produces NULL with two periods, one before and one after. Why?
>>
>>TIA
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform