Show AllShow All

BuildSQL Command (DDE)

Builds an SQL statement one item at a time to create a new query on the DDE channel. This command is available only on the system channel.

Syntax

BuildSQL[(sqltext)]

sqltext A valid SQL statement. If sqltext is 0 (zero) or omitted, the SQL statement is cleared.

Remarks

The BuildSQL command is useful for building long SQL statements. For example, if an SQL statement is too long to send in a single instruction, you can send it in several smaller pieces.

After you build an SQL statement, you can execute it using the QueryNow command.

Example

This example uses the QueryDefinition request item to return the SQL statement for a query.

sql = DDERequest(chan,"QueryDefinition")
		

This example uses the BuildSQL command to resend the returned SQL string with an additional WHERE clause.

DDEExecute chan, "[BuildSQL(""" & sql & """)]"
DDEExecute chan, "[BuildSQL("WHERE Freight > 10")]"
DDEExecute chan, "[QueryNow()]