General information
Category:
Databases,Tables, Views, Indexing and SQL syntax
¿Por qué mejor no llamas a un procedimiento almacenado para insertar el registro pasandole un parámetro de entrada-salida y en este colocas el valor agregado para la columna identity?
Suponiendo que en la tabla Temporal existe un campo 'identity' el código en el sp sería:
CREATE PROCEDURE dbo.AddTemporal
@tIdentidad int output,
@tDescripcion varchar(20)
AS
SET NOCOUNT ON
insert into Temporal
(Descripcion)
values
(@tDescripcion)
set @tIdentidad = @@IDENTITY
return (0)
GO
Luego en VFP preguntas por el valor de la variable así:
Local lnConn as Integer
Local lnIdent as Integer
Local lcvalor as String
lnIdent = 0
lcValor = "Texto"
lnConn = Sqlconnect([cadenadeconexion])
Sqlexec(lnConn, [{CALL AddTemporal(?@lnIdent, ?lcValor)}], [result])
Sqldisconnect(lnConn)
? lnIdent
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only