Stored procedure returns int instead of result set

后端 未结 17 2074
说谎
说谎 2020-12-03 13:02

I have a stored procedure that contains dynamic select. Something like this:

ALTER PROCEDURE [dbo].[usp_GetTestRecords] 
    --@p1 int = 0, 
    --@p2 int =          


        
17条回答
  •  执念已碎
    2020-12-03 13:49

    I had the same problem, I changed the name of return fields by 'AS' keyword and addressed my problem. One reason for this problem is naming column names with SQL Server reserved keywords.

    The example is fallows:

    ALTER PROCEDURE [dbo].[usp_GetProducts]
    
    AS
    BEGIN
    
     SET NOCOUNT ON;
    
     SELECT 
          , p.Id
          , p.Title
          , p.Description AS 'Description'
    
        FROM dbo.Products AS p
    END
    

提交回复
热议问题