Surendra Sharma

Surendra Sharma

Search This Blog

Friday, February 7, 2014

How to create sp_executesql in Sybase IQ

In SQL Server, sp_executesql stored procedure is used to execute a dynamic Transact-SQL statement or batch statements.

But in Sybase IQ, there is no such stored procedure. However you can create it as below

CREATE OR REPLACE PROCEDURE usp_executesql(
    IN cSQL VARCHAR(32767))
BEGIN
    EXECUTE IMMEDIATE WITH RESULT SET ON cSQL;
END;

Here cSQL parameter is used as varchar to support ASCII code page supporting 32767 characters in SQL statement.


Please leave your comments or share this tip if it’s useful for you.

No comments:

Post a Comment