LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

With CVI SQL Toolkit ,How to add new column by variable param into a table .

Solved!
Go to solution

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!

 

 

0 Kudos
Message 1 of 3
(3,353 Views)
Solution
Accepted by topic author lijie1116@yahoo.com.cn

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

National Instruments
Applications Engineer
0 Kudos
Message 2 of 3
(3,322 Views)

Tks!  As your advice,I solved this problem.

0 Kudos
Message 3 of 3
(3,304 Views)