Showing posts with label functions. Show all posts
Showing posts with label functions. Show all posts

Sunday, February 12, 2012

Are window functions exist in Katmai CTP3?

What about implementing window functions. Was it implemented in CTP3 or will they be implemented in following CTPs?

See my request:

https://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=125053

And Itzik Ben-Gan's request:

https://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=254397

No, windowing functions are not available in SQL Server 2008 June CTP. Your request on http://connect.microsoft.com is on our radar (thanks for submitting it!), along with many other requests for similar functionality. Unfortunately, not all requests can make it into a release. Windowing functions are still on our list and would be considered for a future release.

Thanks

Sara|||

Hi Sara

Do you mean that windowing functions might still make it into the RTM of 2008 (ie a future CTP release), or that it will be a post-SQL2008 release?

Ewan

Are window functions exist in Katmai CTP3?

What about implementing window functions. Was it implemented in CTP3 or will they be implemented in following CTPs?

See my request:

https://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=125053

And Itzik Ben-Gan's request:

https://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=254397

No, windowing functions are not available in SQL Server 2008 June CTP. Your request on http://connect.microsoft.com is on our radar (thanks for submitting it!), along with many other requests for similar functionality. Unfortunately, not all requests can make it into a release. Windowing functions are still on our list and would be considered for a future release.

Thanks

Sara|||

Hi Sara

Do you mean that windowing functions might still make it into the RTM of 2008 (ie a future CTP release), or that it will be a post-SQL2008 release?

Ewan

Are there MIN(A,B) or MAX(A,B) functions in SQL?

Just wondering, since I came across a case where I have to select the MIN of 2 dates, or MAX of 2 dates

say I want

min_date = MIN(dateA, dateB)

max_date = MAX(dateA, dateB)

I can probably do it with CASE statement, but that seems a bit clumsy

like min_date = CASE WHEN dateA < dateB THEN dateA ELSE dateB END

Thanks

If I were you, I would write a function that returns the min or max of the two and call that function in your statement. Like this:

create function dbo.udf_maxdate
(
@.date1 datetime,
@.date2 datetime
)
returns datetime
as
begin
declare @.returndate datetime
set @.returndate = case when @.date1>@.date2 then @.date1 else @.date2 end
return(@.returndate)
end|||

Unfortunately, no.

You could create your own. Perhaps passing in an array of values (as a string/varchar). Then using something like Jen Suessmeyer's Split function, move the array values into a table variable, use Min() or Max() and return the appropriate value.

Split Function (Jens Suessmeyer)
http://forums.microsoft.com/TechNet/ShowPost.aspx?PostID=419984&SiteID=17
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=326300&SiteID=1

|||

Thanks guys

I just used CASE statements, good enough for the one-time fix