2012年2月26日星期日

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.Hmmmm..

SELECT 1

??????|||I'm not sure that I understand, but let's try an example and maybe we can at least get closer:DECLARE @.target DATETIME
SET @.target = GetDate()
SELECT Convert(DATETIME, Convert(CHAR(8), @.target, 121) + '01'), @.target-PatP|||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..|||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|||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....|||http://www.sqljunkies.com/HowTo/6676BEAE-1967-402D-9578-9A1C7FD826E5.scuk

Maybe this would help :)

没有评论:

发表评论