﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / SQL Server 2005 / T-SQL (SS2K5)  / Help Needed - Function Returning Table / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Tue, 21 May 2013 19:19:29 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Help Needed - Function Returning Table</title><link>http://www.sqlservercentral.com/Forums/Topic758971-338-1.aspx</link><description>Hey Lowell &amp; Matt u both rocks,thanks for your guidance</description><pubDate>Sun, 26 Jul 2009 22:35:45 GMT</pubDate><dc:creator>windows_mss</dc:creator></item><item><title>RE: Help Needed - Function Returning Table</title><link>http://www.sqlservercentral.com/Forums/Topic758971-338-1.aspx</link><description>your function is fine, it's the function call...since it is returning a table, you need SELECT * FROM, not SELECT:[code]select * from dbo.testFunction(getdate(),getdate()+30);--results:2009-07-27 00:15:08.4602009-07-28 00:15:08.4602009-07-29 00:15:08.4602009-07-30 00:15:08.4602009-07-31 00:15:08.460etc....[/code]</description><pubDate>Sun, 26 Jul 2009 22:18:09 GMT</pubDate><dc:creator>Lowell</dc:creator></item><item><title>RE: Help Needed - Function Returning Table</title><link>http://www.sqlservercentral.com/Forums/Topic758971-338-1.aspx</link><description>hi Matt,thanks for your kind reply,when i created that function, and executed it like this,[code="sql"]CREATE FUNCTION dbo.testFunction(@STARTDATE datetime,@EntDt datetime)RETURNS TABLEASRETURN with DateList as (    select cast(@STARTDATE as datetime) DateValue     union all    select DateValue + 1 from    DateList        where  DateValue + 1 &lt; convert(VARCHAR(15),@EntDt,101) )select * from DateList where DATENAME(WEEKDAY, DateValue ) not IN ( 'Saturday','Sunday' )GOselect dbo.testFunction(getdate(),getdate()+30);Msg 4121, Level 16, State 1, Line 1Cannot find either column "dbo" or the user-defined function or aggregate "dbo.testFunction", or the name is ambiguous.[/code]guidance needed,thanks in advance.</description><pubDate>Sun, 26 Jul 2009 21:54:24 GMT</pubDate><dc:creator>windows_mss</dc:creator></item><item><title>RE: Help Needed - Function Returning Table</title><link>http://www.sqlservercentral.com/Forums/Topic758971-338-1.aspx</link><description>just remove the ;[code]CREATE FUNCTION dbo.testFunction(@STARTDATE datetime,@EntDt datetime)RETURNS TABLEASRETURNwith DateList as  (     select cast(@STARTDATE as datetime) DateValue      union all     select DateValue + 1 from    DateList         where  DateValue + 1 &lt; convert(VARCHAR(15),@EntDt,101)  )select * from DateList where DATENAME(WEEKDAY, DateValue ) not IN ( 'Saturday','Sunday' )GO[/code]Let me know if this works</description><pubDate>Fri, 24 Jul 2009 06:18:20 GMT</pubDate><dc:creator>matt6288</dc:creator></item><item><title>Help Needed - Function Returning Table</title><link>http://www.sqlservercentral.com/Forums/Topic758971-338-1.aspx</link><description>when i compiling the following code, getting this error[b]Msg 102, Level 15, State 1, Procedure fnGetNoOfBusinessDays, Line 6Incorrect syntax near ';'.[/b][code="sql"]CREATE FUNCTION dbo.fnGetNoOfBusinessDays (@STARTDATE datetime,@EntDt datetime)RETURNS TABLE ASRETURN ;with DateList as   (      select cast(@STARTDATE as datetime) DateValue      union all      select DateValue + 1 from    DateList         where  DateValue + 1 &lt; convert(VARCHAR(15),@EntDt,101)   )select * from DateList where DATENAME(WEEKDAY, DateValue ) not IN ( 'Saturday','Sunday' )GO[/code]</description><pubDate>Fri, 24 Jul 2009 06:08:16 GMT</pubDate><dc:creator>windows_mss</dc:creator></item></channel></rss>