Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to use datetime difference in SQL Select?
Message
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Versions des environnements
SQL Server:
SQL Server 2005
Divers
Thread ID:
01390159
Message ID:
01390185
Vues:
49
>>>I got:
>>>Operand data type datetime is invalid for sum operator.
>>>Because DATETIME1 - DATETIME2 is also datetime.
>>>
>>>DECLARE @Test TABLE (Fld1 datetime, Fld2 datetime)
>>>DECLARE @i int
>>>SET @i = 0
>>>WHILE @i < 20
>>>      BEGIN 
>>>         INSERT INTO @Test VALUES (GETDATE()+@i, GETDATE()+@i*20)
>>>         SET @i = @i +1
>>>      END
>>>SELECT SUM(Fld2-Fld2) FROM @Test
>>>
>>
>>I've no,idea what you're talking about :)
>
>
>ROFL
>Yep, now you haven't :-)

8-)
--sb--
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform