Executing SQL - CREATE TABLE

This Q&A forum allows users to post and respond to "How Do I Do ....." questions. Please do not use to report (suspected) errors - you must use your regional help desk for this. The information contained in this forum has not been validated by LANSA and, as such, LANSA cannot guarantee the accuracy of the information.
Post Reply
mark.civ
Posts: 8
Joined: Wed Jan 27, 2021 11:34 pm

Executing SQL - CREATE TABLE

Post by mark.civ »

Hi,

I have a need to dynamically create a database table based on a CSV file being imported. I am clear with reading the CSV file, processing the header for column names, etc., but I am unsure how to create the table in this scenario.

Clearly, SQL like 'CREATE TABLE XXXDTALIB.TestTable ( Data1 nvarchar(1000), Data2 nvarchar(1000), Data3 nvarchar(1000) );' would work as SQL, but I am wondering how would I execute this from within a LANSA once I've built the string in question?

Thanks.
User avatar
Dino
Posts: 472
Joined: Fri Jul 19, 2019 7:49 am
Location: Robbinsville, NC
Contact:

Re: Executing SQL - CREATE TABLE

Post by Dino »

You could use the create table in a select_sql command , like these:

viewtopic.php?f=3&t=2595&p=7678&hilit=S ... _dql#p7803
Post Reply