Hola Amigos:
Tengo un store que hace un insert, no sin antes calcular el ultimo
indice de la tabla, para agregarle el siguiente, pero al usarlo en
otro equipo hace un conflicto, ya que hace duplicado de indice y me
bota el error de restriccion en primary key.
ALTER Procedure [dbo].[usp_Pub_Detalle_Guardar]
@Control numeric = null output,
@Sku varchar(50)
As
Declare @Cont Numeric
Set @Cont = (Select Max(Control) From PublicacionesDetalle)
If @Cont = 0 Or @Cont Is Null
Set @Control = 1
Else
Set @Control = @Cont + 1
Insert Into PublicacionesDetalle
(Control,ConPublic,Sku)
Values
(@Control,0,@Sku)
Puden ayudarme porfa???
Gracias,
SystemBuilder
Leer las respuestas