From NWN Lexicon
Revision as of 18:09, 18 January 2021 by Hendrik (talk | contribs) (corrected function return type)
Jump to: navigation, search
Nwnee logo.jpg Note: This article documents Neverwinter Nights: Enhanced Edition new content or changes/updates/fixes to 1.69 functions. These are all listed under the category and patches pages.

Executes the given query and fetches a row.

int SqlStep(
    sqlquery sqlQuery


An already prepared SQL query


Executes the given query and fetches a row; returning TRUE if row data was made available; FALSE otherwise. Note that this will return FALSE even if the query ran successfully but did not return data.

You need to call SqlPrepareQueryCampaign or SqlPrepareQueryObject and potentially SqlBind* functions before calling this.


This is required to execute any SQL query, even if there is no "true data" to retrieve, such as when creating a table. Use SqlGetError to retrieve any issues running the query.


This function was added in 1.80.8193.14 of NWN:EE.


    sqlquery n = SqlPrepareQueryObject(GetFirstPC(), "select widget from widgets;");
    while (SqlStep(n))
        SendMessageToPC(GetFirstPC(), "Found widget: " + SqlGetString(n, 0));

See Also


SqlPrepareQueryCampaign SqlPrepareQueryObject SqlBindInt SqlBindFloat SqlBindString SqlBindVector SqlBindObject