No, READ is a DBISQL command (like INPUT and OUTPUT) whereas EXECUTE IMMEDIATE is executed in the database engine. It's the same reason why stored procedures cannot contain OUTPUT commands. What exactly are you trying to achieve? Note, you can use PARAMETERS within DBISQL scripts and therefore parametrize the statements within command files, if that's what you up to. And of course, within your SQL code, you can build command lines for DBISQL and any script files and then use xp_cmdshell to run them... 1
You could use xp_read_file to supply the content to execute immediate. For example; execute immediate(xp_read_file( 'c:\temp\myScript.sql' )) This assumes that the myScript.sql is accessible on the same machine as the database server. If not, you could use the READ_CLIENT_FILE procedure but that would require a more involved setup.
(03 Jun, 13:39)
Chris Keating
|