You use the DBM command to transfer an SQL statement to the database instance. Unlike when using the sql_executenice DBM command, you want the reply to display as many data records as possible.
When you execute this command, it implicitly opens an SQL session with the database instance and then ends the session once the command has been executed.
With SQL statements that can only be executed by particular database users, we recommend first starting an SQL session with the data of this database user (see: sql_connect), executing all SQL statements and then either closing the SQL session (see: sql_release) or the Database Manager CLI.
With SELECT statements, the system displays the data records of the reply. If not all the data can be displayed because of limited reply memory, you can use the sql_fetch DBM command to display the remaining data records.
If you enter other SQL statements, the execution of the statement is confirmed with an OK message.
For more information about SQL statements, see the Reference Manual and SQL Tutorial
Prerequisites
· You are working in the session mode of the Database Manager CLI.
· You have the server authorization AccessSQL.
sql_execute <user_identification> <statement>
<user_identification> :: = <user_spec> | <user_type>
<user_spec> :: = <database_user>,<database_user_password>
<user_type> :: = user-type=<value>
Options
Option |
Description |
<statement> |
SQL Statement |
<database_user> |
Name of the database user |
<database_user_password> |
Password of the database user |
user-type=<value> |
User type, possible values are: DBM: first DBM user DBA: database system administrator SAP: special database user in connection with SAP applications |
OK
[END|CONTINUE]
[<record>
<record>
...]
Values for the Reply Fields
Value |
Description |
END |
The complete reply was output. |
CONTINUE |
More data records are available but were not transferred due to the limited size of the reply memory. |
<record> |
Result data of the SQL statements The fields in a
data record are separated by semicolons. |
In the event of errors, see Reply Format
...
Logging on to the Database Manager CLI in session mode as operator OLEG with the password MONDAY, connecting to the database instance DEMODB, displaying the columns of the USERS table with the relevant comments:
>dbmcli -u OLEG,MONDAY -d DEMODB
dbmcli on DEMODB>sql_execute SELECT columnname, comment FROM domain.columns WHERE tablename = 'USERS'
OK
END
'OWNER';(long)
'GROUPNAME';(long)
'USERNAME';(long)
'USERMODE';(long)
'CONNECTMODE';(long)
'MAXTIMEOUT';(long)
'COSTWARNING';(long)
'COSTLIMIT';(long)
'DEFAULTCODE';(long)
'CREATEDATE';(long)
'CREATETIME';(long)
'ALTERDATE';(long)
'ALTERTIME';(long)
'PWCREADATE';(long)
'PWCREATIME';(long)
'SERVERDB';(long)
'SERVERNODE';(long)
'USER_ID';(long)
'ISREPLICATIONUSER';(long)
'COMMENT';(long)