Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Incorporate a parameter into a script
Message
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Incorporate a parameter into a script
Miscellaneous
Thread ID:
01676759
Message ID:
01676759
Views:
39
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
Next
Reply
Map
View

Click here to load this message in the networking platform