09/09/2008, 12:19
|
| | Fecha de Ingreso: febrero-2007
Mensajes: 139
Antigüedad: 17 años, 11 meses Puntos: 0 | |
Respuesta: Declarar vector en procedim almacenad hola,
Esta es mi idea: Cita: CREATE PROCEDURE spTempCubas
AS
DECLARE @FECHA DATETIME
DECLARE @Temp(18,3) varchar(10)
set @FECHA = GETDATE()
SET @Temp (0,0) =@ FECHA
SET @Temp (0.1) = 'Cuba 41'
Select @Temp (0,2) = Value from runtime.dbo.v_AnalogLive where TagName = 'k141'
SET @Temp (1,0) =@ FECHA
SET @Temp (1.1) = 'Cuba 42'
Select @Temp (1,2) = Value from runtime.dbo.v_AnalogLive where TagName = 'k142'
SET @Temp (2,0) =@ FECHA
SET @Temp (2.1) = 'Cuba 43'
Select @Temp (2,2) = Value from runtime.dbo.v_AnalogLive where TagName = 'k143'
SET @Temp (3,0) =@ FECHA
SET @Temp (3.1) = 'Cuba 44'
Select @Temp (3,2) = Value from runtime.dbo.v_AnalogLive where TagName = 'k144'
SET @Temp (4,0) =@ FECHA
SET @Temp (4.1) = 'Cuba 45'
Select @Temp (4,2) = Value from runtime.dbo.v_AnalogLive where TagName = 'k145'
SET @Temp (5,0) =@ FECHA
SET @Temp (5.1) = 'Cuba 46'
Select @Temp (5,2) = Value from runtime.dbo.v_AnalogLive where TagName = 'k146'
SET @Temp (6,0) =@ FECHA
SET @Temp (6.1) = 'Cuba 47'
Select @Temp (6,2) = Value from runtime.dbo.v_AnalogLive where TagName = 'k147'
SET @Temp (7,0) =@ FECHA
SET @Temp (7.1) = 'Cuba 48'
Select @Temp (7,2) = Value from runtime.dbo.v_AnalogLive where TagName = 'k148'
SET @Temp (8,0) =@ FECHA
SET @Temp (8.1) = 'Cuba 49'
Select @Temp (8,2) = Value from runtime.dbo.v_AnalogLive where TagName = 'k149'
SET @Temp (9,0) =@ FECHA
SET @Temp (9.1) = 'Cuba 50'
Select @Temp (9,2) = Value from runtime.dbo.v_AnalogLive where TagName = 'k150'
SET @Temp (10,0) =@ FECHA
SET @Temp (10.1) = 'Cuba 51'
Select @Temp (10,2) = Value from runtime.dbo.v_AnalogLive where TagName = 'K151'
SET @Temp (11,0) =@ FECHA
SET @Temp (11.1) = 'Cuba 52'
Select @Temp (11,2) = Value from runtime.dbo.v_AnalogLive where TagName = 'K152'
SET @Temp (12,0) =@ FECHA
SET @Temp (12.1) = 'Cuba53'
Select @Temp (12,2) = Value from runtime.dbo.v_AnalogLive where TagName = 'K153'
SET @Temp (13,0) =@ FECHA
SET @Temp (13.1) = 'Cuba 54'
Select @Temp (13,2) = Value from runtime.dbo.v_AnalogLive where TagName = 'K154'
SET @Temp (14,0) =@ FECHA
SET @Temp (14.1) = 'Cuba 55'
Select @Temp (14,2) = Value from runtime.dbo.v_AnalogLive where TagName = 'K155'
SET @Temp (15,0) =@ FECHA
SET @Temp (15.1) = 'Cuba 56'
Select @Temp (15,2) = Value from runtime.dbo.v_AnalogLive where TagName = 'K156'
SET @Temp (16,0) =@ FECHA
SET @Temp (16.1) = 'Cuba 57'
Select @Temp (16,2) = Value from runtime.dbo.v_AnalogLive where TagName = 'K157'
SET @Temp (17,0) =@ FECHA
SET @Temp (17.1) = 'Cuba 58'
Select @Temp (17,2) = Value from runtime.dbo.v_AnalogLive where TagName = 'K158'
for i = 0 to 17
INSERT INTO TemperaturaCubas (FECHA, Cuba, Temperatura) VALUES ( @Temp (i,0) , @Temp (i,1) , @Temp (i,2) )
next
GO Creo que es lo mismo que ustedes planten, ir insertando de una vez.
Pero si me gustaria saber lo del recorrido de la variable.
Gracias por su ayuda |