Results 1 to 7 of 7
  1. #1
    Join Date
    Aug 2003
    Posts
    23

    Unanswered: First day of a month

    Hi to all..
    is there a function in sql server 2k that returns the first day of a date (month)????
    thx!

    Ale.
    Alx_81 =)

  2. #2
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    Hmmmm..

    SELECT 1


    ??????????????
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  3. #3
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    I'm not sure that I understand, but let's try an example and maybe we can at least get closer:
    Code:
    DECLARE @target DATETIME
    SET @target = GetDate()
    SELECT Convert(DATETIME, Convert(CHAR(8), @target, 121) + '01'), @target
    -PatP

  4. #4
    Join Date
    Aug 2003
    Posts
    23

    Wink ok..

    i wouldn't to use cast and convert in string..
    i thinked there's a database function..
    for example.. dateserial in Visual Basic..
    i think that this function are so good =)
    don't you think??? =))))
    ok.. thx anyway..
    Alx_81 =)

  5. #5
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    What do you see as the problem? If you can coach me a bit as to what you would like to see, I might be able to find you a better answer, but I think that this code does what you requested.

    -PatP

  6. #6
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    What? 1 is not the first day of the month?

    Show us an example of what you are looking for.....

    Usually the ask for the last day of the month.....
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  7. #7
    Join Date
    Jul 2003
    Location
    The Dark Planet
    Posts
    1,401
    Get yourself a copy of the The Holy Book

    order has no physical Brett in The meaning of a Kaiser . -database data

Posting Permissions

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