¿Cómo pasar el valor de la instrucción select?
Frecuentes
Visto 102 veces
0
i have this line of code in SQL server 2008 R2
select * from [Db].[dbo].[cart] where date < DATEADD(MINUTE, -30, GETDATE())
i want count all data that satisfy the condition and passed to a variable like
Declare @loop
i will use the variable to know the loop count..
The question is: How can i passed the Value of Select statement to the @loop variable.
Gracias
2 Respuestas
0
¿Qué tal
DECLARE @loop INT
select @loop = COUNT(1)
from [Db].[dbo].[cart]
where date < DATEADD(MINUTE, -30, GETDATE())
Echa un vistazo a SELECT @local_variable (Transact-SQL)
Respondido 28 ago 12, 10:08
0
¿Has probado
SELECT @loop = @@RowCount
Respondido 28 ago 12, 10:08
No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas select loops count sql-server-2008-r2 or haz tu propia pregunta.