Results 1 to 3 of 3

Thread: Getdate()????

  1. #1
    Join Date
    May 2003
    Posts
    25

    Unanswered: Getdate()????

    I declared a @Start and @End, and now I want to bring in todays date @End and 30 days pevious as start... These two commands give me those 2 pieces of data but how do I use(assign) Start and End to these????



    SELECT CONVERT(CHAR(10), GETDATE(), 101)
    SELECT CONVERT(CHAR(10), GETDATE()-30, 101)

  2. #2
    Join Date
    May 2003
    Location
    Sao Paulo, Brazil
    Posts
    6

    Smile

    DECLARE @Start char(10), @End char (10)

    SELECT @Start = CONVERT(CHAR(10), GETDATE(), 101)
    SELECT @End = CONVERT(CHAR(10), GETDATE()-30, 101)

    SELECT @Start, @End

  3. #3
    Join Date
    Jan 2003
    Location
    India
    Posts
    523
    how about:
    DECLARE @Start char(10), @End char (10)
    select @start=getdate()
    select @end = dateadd(m,-1,getdate())
    SELECT @Start as 'start', @End as 'end'

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •