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.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 DatePart() Function and SQL Server 6.5

Author  Topic 

ScoobyDoo
Starting Member

4 Posts

Posted - 2003-02-21 : 11:39:43
I found out that SQL 6.5 doesn't supprt User-Defined Functions and I can't create one to handle DatePart. Is there another way to do this? Possibly writing a Function in VBScript to be used in my ASP page or?? If so how?

Thanks.


DatePart
Returns the date part of the datetime value.

CREATE FUNCTION dbo.DatePart
( @fDate datetime )
RETURNS varchar(10)
AS
BEGIN
RETURN ( CONVERT(varchar(10),@fDate,101) )
END
GO


This example returns a character string contained the date part
of the datetime value:

'sc.DateTimeIntiated = '11/11/2001 11:15AM'

SELECT dbo.DatePart(sc.DateTimeInitiated)
GO


Here is the result set:

----------
11/11/2000

(1 row(s) affected)


robvolk
Most Valuable Yak

15732 Posts

Posted - 2003-02-21 : 11:44:53
Why don't you just use CONVERT(varchar(10), dateCol,101) in your query? SQL 6.5 handles CONVERT rather nicely.

Go to Top of Page
   

- Advertisement -