Operation failed: There was an error while applying the SQL script to the database. ERROR 3954: Misplaced INTO clause, INTO is not allowed inside subqueries, and must be placed at end of UNION clauses. code example

Example 1: GET AROUND MAXIMIN PREFIX FOR RPC OUT ON LINKED SERVER

DECLARE @name sysname,
        @sql  nvarchar(MAX)

SELECT @sql = 
   'DECLARE cur CURSOR STATIC LOCAL FOR
       SELECT TOP (5) CompanyName FROM dbo.Customers
       ORDER  BY CustomerID'

EXEC sp_executesql @sql

OPEN cur

Example 2: GET AROUND MAXIMIN PREFIX FOR RPC OUT ON LINKED SERVER

DECLARE cur CURSOR STATIC LOCAL FOR
   SELECT ...

Tags:

Misc Example