What is the diffrence between SQLExec and CreateSQL?

Showing Answers 1 - 11 of 11 Answers


According to me

CreateSQL is used to describe a query like &sql1=CreateSQl(" ur query");

and SQLExec is used to execute that query like SQLExec(&sql1);

I am not so sure abt this.

  Was this answer useful?  Yes


  • Nov 8th, 2006

SqlExec means it byepasses the component buffer and its directly contacts database to retrieve data. But it retrieves the data row by row and not possible for bulk insert.

But in the case of Create SQL we can able insert the data in bulk.

  Was this answer useful?  Yes


  • Nov 23rd, 2006

Sqlexec is used to select, insert, update or delete a single record using a sql statement. Sqlexec executes the sql comand from within pcode bypassing the component processor and interacts dorectly with database server.

If you want to select, insert, update or delete a series of record then use getsql or createsql and then execute sql class method.

Harish Mahanta

  • Nov 28th, 2006

Ans:- SQLExec UPDATEs, INSERTs, and DELETEs go directly to the database server, not to the Component Processor. CreateSQL only retrive the data.

  Was this answer useful?  Yes


  • Dec 19th, 2006

Perhaps surprising to some...SQLExec EXECUTES the SQL you pass as a parameter, right then and there: SQLExec("Update table set fieldA = valA where fieldB = valB");CreateSql CREATES an SQL object, think Object Oriented Programming 'cause that's all it is. This object has properties and methods you can then execute, such as execute(): Local SQL &sql = CreateSQL("Select field from table where fieldA = :1", "x"); While &sql.fetch(&variable) ... do stuff with &variable end-While;

  Was this answer useful?  Yes


  • Jan 6th, 2007

There are two basic differences:

1st : If you want to delete, insert, or update a single record, use the SQLExec along with corresponding PeopleCode record object method.

If you want to delete, insert, or update a series of records, all of the same type, use the CreateSQL or GetSQL functions, not the Execute SQL class method.

2nd : SQLExec can only Select a single row of data. If your SQL statement (or your SQL.sqlname statement) retrieves more than one row of data, SQLExec sends only the first row to its output variables. Any subsequent rows are discarded. If you need to SELECT multiple rows of data, use the CreateSQL or GetSQL functions and the Fetch SQL class method.

Create SQL is a people tool definition which can be created using application designer as well as using people code command create sql(). It is mainly used for reusability of the sql statemetns.

SQL Exec is a built-in function in people code. It is used  to retrieve one row and can update multiple rows of data.  It directly interact with the database.

  Was this answer useful?  Yes


  • Oct 21st, 2008

The main Difference Between SqlExec and CreateSql is SqlExec directly interactive with
data base but Createsql not directly interactive with the data base

  Was this answer useful?  Yes


  • Aug 15th, 2011

with the help of SQLExec, we can fetch only one row of multiple same rows.
with the help of CreateSql, we can fetch all the rows.

  Was this answer useful?  Yes


  • May 3rd, 2019

SQLEXEC - Can only select single row of data and it will insert only single row by row.
CREATESQL - It will insert all rows at a time

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.


Related Answered Questions


Related Open Questions