unfortunately user-defined functions weren't available with SQL Server
until SQL 2000 / version 8 ... afaik all those functions are available
in sql 7, so you can write them into your sql query, you just can't
encapsulate them in a function without upgrading.

> How do I create this in SQL Server 7.0? I tried creating
> it and got errors..

> Server: Msg 170, Level 15, State 1, Line 2
> Line 2: Incorrect syntax near 'function'.
> Server: Msg 178, Level 15, State 1, Line 7
> A RETURN statement with a return status can only be used
> in a stored procedure.

> If I can get this to work that would be awesome!

> Brook


> At 01:05 PM 12/3/2004, you wrote:
>> > If I have a SQl Server datetime field, and I want to
>> > return it like
>> > 'mm/dd/yy', is there a function I can use in the select
>> > statement to do this?
>>
>> > Brook
>>
>>afaik not a simple one...
>>
>>you can however hack a few of them together or create a
>>udf in sql
>>server to do this:
>>
>>create function dbo.mydate
>>   @mydate datetime
>>as
>>
>>return replace(str(month(mydate),2,0),' ','0')
>>         + replace(str(day(mydate),2,0),' ','0')
>>         + right(str(year(mydate),4,0),2)
>>go
>>
>>
>>or something to that effect...
>>
>>str() formats a number as a string (think numberformat but
>>not nearly
>>as powerful), day(), month() and year() return the numbers
>>from your
>>date...
>>
>>
>>s. isaac dealey   954.927.5117
>>
>>new epoch : isn't it time for a change?
>>
>>add features without fixtures with
>>the onTap open source framework
>>http://www.sys-con.com/story/?storyid=44477&DE=1
>>http://www.sys-con.com/story/?storyid=45569&DE=1
>>http://www.fusiontap.com
>>
>>
>>
>>
>>

> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Special thanks to the CF Community Suite Gold Sponsor - CFHosting.net
http://www.cfhosting.net

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:186185
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to