How to run large SQL statements on new lines
7 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Dan Howard
am 25 Okt. 2018
Beantwortet: Dan Howard
am 26 Okt. 2018
Good afternoon all...
Little questions regarding SQL statements in Matlab. I am currently using 2018 version and have produced a script that connects to a database and extracts data using a simple SQL statement.
I am trying to understand how you can tidy up the script by using larger SQL queries to extract more data by using a new line e.g ...
if true
% %Open the connection string- connect to Database
conn.Open(connection_string1);
SQL = 'select table.leg_no', ...
'from table');
end
This will only work if I place the whole statement on one line. I have tried [] and ().
Eventually I would like to create larger SQL queries that can be stored into variables to use in a GUI.
Really appreciate some help with this..Many thanks :-)
Please note: I am not running with the DataBase Toolbox.
0 Kommentare
Akzeptierte Antwort
Guillaume
am 25 Okt. 2018
Bearbeitet: Guillaume
am 25 Okt. 2018
Your question is really about how to input a char vector using more than one line:
SQL = ['select table.leg_no ', ...
'from table ', ...
'where table.col1 = 12345'];
edit: don't forget the spaces as I did originally, matlab won't insert them between each line for you.
0 Kommentare
Weitere Antworten (2)
Siehe auch
Kategorien
Mehr zu Database Toolbox finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!