Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to do var substitution?
Message
De
30/01/2001 18:16:39
 
 
À
30/01/2001 16:34:14
Evans Carl
System Answers Consulting, Inc
Big Lake, Minnesota, États-Unis
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Divers
Thread ID:
00470308
Message ID:
00470402
Vues:
48
I may be way off base here as I'm relatively new to playing with sql and tsql. But since you asked me, what comes to mind is to use DATEPART in your comparison.

Hope this helps,
-Isaac

>Can someone please tell me how to get around this problem with the datetime format. I want the string to answer "Your the Man". The problem is time1 will usually come from a table and time2 from a control on a form and when using the datetime. time1 will be after get date 01/30/00 16:30:21 and time2 with be 01/30/00 00:00:00. And when you ask if the dates are equal (and they should be) but sql does not consider them to be. Why????!! Is there a way to turn off the time for all datetime functions.
>
>
>
>declare @time1 datetime
>declare @time2 datetime
>declare @string1 varchar(20)
>declare @string2 varchar(20)
>
>set @time1 = getdate()
>set @time2 = '01/30/00'
>
>
>select @time1
>select @time2
>if @time2 >= @time1
> begin
> set @string1 = "Your the Man"
> select @string1
> end
>else
> set @string2 = "Your the Woman"
> select @string2
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform