09-28-2010 08:11 AM
Dear All:
I used CVI Sql toolkit to create a database , but now I don't know how to add a new column into a table by variable param.
I know, to add a column with constant column name can be down by bellow:
DBImmediateSQL ((hdbc,"alter table table1 add column1 char[100]");
But when column1 is a variablae param how could I write the code ? please advise? it will be appreciated if you could give me a example.
Best Regards!
Solved! Go to Solution.
09-29-2010 05:13 PM
Hi -
If you look at the parameters you are passing to the SQL function, you can see that the second parameter is a string constant. In your code, you can create a character array (string). Then you can use sprintf to programmatically determine what the contents of that variable will be. In the function call, you can put the variable instead of the string literal, and you will have a customizable SQL statement.
Hope this helps -
John M
09-30-2010 08:20 AM
Tks! As your advice,I solved this problem.