Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
stharish
Starting Member
43 Posts |
Posted - 2012-01-07 : 22:10:24
|
| Microsoft SQL Server...What syntax would you use to set two datetime parameters? I want a set a FROM and TO datetime. Specifically I want the @From parameter to be set to 0700 of the current date and the @To set at 1900 of the current date.DECLARE @From as DatetimeDECLARE @To as DatetimeSET @From=????SET @To=???? |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-01-08 : 02:28:23
|
| [code]DECLARE @From as DatetimeDECLARE @To as DatetimeSET @From=DATEADD(hh,7,DATEADD(dd,DATEDIFF(dd,0,GETDATE()),0))SET @To=DATEADD(hh,19,DATEADD(dd,DATEDIFF(dd,0,GETDATE()),0))...[/code]------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
stharish
Starting Member
43 Posts |
Posted - 2012-01-08 : 11:13:25
|
| Perfect! Thank you. |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
|
|
|
|
|