seems like a limitation of the DBAPI in use. have you tried creating
a test script using just raw (pyodbc | adodbapi | pymssql) ?
On May 19, 2009, at 2:23 PM, Daniel wrote:
>
> Hello,
>
> I have a stored procedure for SQL Server and I would like to be able
> to execute the code to create the stored procedure using SA. Here's
> the basic idea.
>
> engine = sqlalchemy.create_engine('mssql://connectionString')
> engine.execute(myStoredProcedure)
>
> Where:
> myStoredProcedure = """
> PRINT 'generate mySP stored procedure'
> IF object_id('mySP') IS NOT NULL
> BEGIN
> DROP PROCEDURE mySP
> END
> GO
>
> CREATE PROCEDURE mySP
> AS
> DECLARE @aVar VARCHAR(48)
> BEGIN
> SELECT TOP 1
> @aVar = aVar
> FROM [dbo].[someTable] (UPDLOCK)
> WHERE
> priority > 0
> ORDER BY
> priority DESC
>
> SELECT
> @aVar AS aVar
> END
> GO
> """
>
> The problem is that I'm getting an error complaining about invalid
> syntax "ProgrammingError: (ProgrammingError) ('42000', "[42000]
> [Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near
> the keyword 'CREATE'"
>
> I know the stored procedure call works since I can run it against the
> database. What do I need to do to execute my script from SA?
>
> Thanks.
>
> >
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---