Ver Mensaje Individual
  #4  
Antiguo 16-06-2008
Avatar de poliburro
[poliburro] poliburro is offline
Miembro Premium
 
Registrado: ago 2004
Ubicación: México D.F
Posts: 3.068
Reputación: 23
poliburro Va por buen camino
Código SQL [-]
 
-- =============================================
-- Create procedure basic template
-- =============================================
-- creating the store procedure
IF EXISTS (SELECT name 
    FROM   sysobjects 
    WHERE  name = N'GetIdByPos' 
    AND    type = 'P')
    DROP PROCEDURE GetIdByPos
GO
CREATE PROCEDURE GetIdByPos (@RecNo As Int, @RowId As Int Output)
 
AS

CREATE TABLE #Temporal (RecNo Int IDENTITY(1,1), 
                                    [RowId] [numeric](6, 0))
Insert 
  Into #Temporal  (rowId) 
  Select FieldId From Table
 
Select @RowId = RowId
  From #Temporal
 Where RecNo = @RecNo
 
Drop Table #Temporal

GO
Return
__________________
Conoce mi blog http://www.edgartec.com
Responder Con Cita