I have this procedure:
CREATE PROC proc_copia_pontos
AS
BEGIN
SET NOCOUNT ON
DECLARE @count INT, @i INT, @tab_ponto TABLE ( latitude nvarchar(200), longitude nvarchar(200), precisao INT, dtponto DATETIME, idpontoOrigem INT, flagCorrecao INT )
INSERT @tab_ponto
SELECT latitude, longitude, precisao, dtponto,
idpontoOrigem, flagCorrecao
from tpontos
where id_veiculo='EF48D360-2B0D-47BC-B1BA-0BF6D85BCC17'
and dtponto > '2003-06-07 00:00:00' and dtponto
'2003-06-08 23:59:59' and precisao < '290'
SET @count = SELECT COUNT(*) FROM @tab_ponto
SET @i = 0
WHILE ( @i < @count )
BEGIN
INSERT INTO tpontos (
I want to insert into table tpontos the result that i've stored in @tab_ponto. But @tab_ponto doesn't have all the columns that tpontos has. Actually i want to copy the records that had returned into the same table tpontos but now having id_veiculo='7ED8E9C9-1D2B-408C-B7F7-4AC61D5CDC92'
CREATE PROC proc_copia_pontos
AS
BEGIN
SET NOCOUNT ON
DECLARE @count INT, @i INT, @tab_ponto TABLE ( latitude nvarchar(200), longitude nvarchar(200), precisao INT, dtponto DATETIME, idpontoOrigem INT, flagCorrecao INT )
INSERT @tab_ponto
SELECT latitude, longitude, precisao, dtponto,
idpontoOrigem, flagCorrecao
from tpontos
where id_veiculo='EF48D360-2B0D-47BC-B1BA-0BF6D85BCC17'
and dtponto > '2003-06-07 00:00:00' and dtponto
'2003-06-08 23:59:59' and precisao < '290'
SET @count = SELECT COUNT(*) FROM @tab_ponto
SET @i = 0
WHILE ( @i < @count )
BEGIN
INSERT INTO tpontos (
I want to insert into table tpontos the result that i've stored in @tab_ponto. But @tab_ponto doesn't have all the columns that tpontos has. Actually i want to copy the records that had returned into the same table tpontos but now having id_veiculo='7ED8E9C9-1D2B-408C-B7F7-4AC61D5CDC92'