I am trying to create a stored procedure to achieve the following in the stored procedure:
CREATE PROCEDURE [dbo].[spByTableNameReturnLastRowNew]
@tableName nvarchar(50)
AS
BEGIN
DECLARE @SelectLastRow NVARCHAR(100)
SET @SelectLastRow = 'SELECT TOP 1 * FROM ' + QUOTENAME(@tableName)+ ' ORDER BY AutoNo DESC'
EXECUTE(@SelectLastRow)
RETURN
END
it is work but when calling it by entity framework the result Variable return INT datatype I want to return row (object) to use data not int.
This is the code using the stored procedure in Entity Framework:
var result = milestoneArhEntities.spByTableNameReturnLastRowNew(TableName);