SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Aging report GP Dynamics


Aging report GP Dynamics

Author
Message
decreale
decreale
SSC-Enthusiastic
SSC-Enthusiastic (117 reputation)SSC-Enthusiastic (117 reputation)SSC-Enthusiastic (117 reputation)SSC-Enthusiastic (117 reputation)SSC-Enthusiastic (117 reputation)SSC-Enthusiastic (117 reputation)SSC-Enthusiastic (117 reputation)SSC-Enthusiastic (117 reputation)

Group: General Forum Members
Points: 117 Visits: 31
Comments posted to this topic are about the item Aging report GP Dynamics
SW Skeen
SW Skeen
SSC-Enthusiastic
SSC-Enthusiastic (181 reputation)SSC-Enthusiastic (181 reputation)SSC-Enthusiastic (181 reputation)SSC-Enthusiastic (181 reputation)SSC-Enthusiastic (181 reputation)SSC-Enthusiastic (181 reputation)SSC-Enthusiastic (181 reputation)SSC-Enthusiastic (181 reputation)

Group: General Forum Members
Points: 181 Visits: 717
This script appears to make short work of a problem we experience. However, I can not be sure since it calls '[dbo].[uf_AR_EndPrd_Date]())' which I do not have to make use of.
decreale
decreale
SSC-Enthusiastic
SSC-Enthusiastic (117 reputation)SSC-Enthusiastic (117 reputation)SSC-Enthusiastic (117 reputation)SSC-Enthusiastic (117 reputation)SSC-Enthusiastic (117 reputation)SSC-Enthusiastic (117 reputation)SSC-Enthusiastic (117 reputation)SSC-Enthusiastic (117 reputation)

Group: General Forum Members
Points: 117 Visits: 31
The User Function is nothing more than a date function. It can be commented out and the program will run fine. You could subsititute select cast(getdate() as date) as 'User Date'


USE [XX]
GO
/****** Object: UserDefinedFunction [dbo].[uf_AR_EndPrd_Date] Script Date: 10/14/2014 7:27:36 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
--IF OBJECT_ID (N'dbo.ISOweek', N'FN') IS NOT NULL
-- DROP FUNCTION dbo.ISOweek;
--GO
ALTER FUNCTION [dbo].[uf_AR_EndPrd_Date] ()
RETURNS date

AS
BEGIN

declare @cyr as int
declare @cprd as int
declare @pyr as int
declare @pmth as int
declare @Begdate as date
declare @EndDate as date

set @pmth = (select month(getdate())-1)
set @pyr = (Select year(getdate())-1)
if @pmth = 0
begin
set @pmth = 12
end

if @pmth >=1 and @pmth <12
begin
set @pyr = (select year(getdate()))

end


set @EndDate = (select Perdendt
from servername.DB.dbo.SY40100
where periodID = @pmth
and year1 = @pyr
and series = 3
and odesctn = 'Receivables Cash Receipts')
return(@Enddate)



END
decreale
decreale
SSC-Enthusiastic
SSC-Enthusiastic (117 reputation)SSC-Enthusiastic (117 reputation)SSC-Enthusiastic (117 reputation)SSC-Enthusiastic (117 reputation)SSC-Enthusiastic (117 reputation)SSC-Enthusiastic (117 reputation)SSC-Enthusiastic (117 reputation)SSC-Enthusiastic (117 reputation)

Group: General Forum Members
Points: 117 Visits: 31
The User Function is nothing more than a date function. It can be commented out and the program will run fine.
Iwas Bornready
Iwas Bornready
SSC-Dedicated
SSC-Dedicated (31K reputation)SSC-Dedicated (31K reputation)SSC-Dedicated (31K reputation)SSC-Dedicated (31K reputation)SSC-Dedicated (31K reputation)SSC-Dedicated (31K reputation)SSC-Dedicated (31K reputation)SSC-Dedicated (31K reputation)

Group: General Forum Members
Points: 31810 Visits: 885
Thanks for the tip.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum







































































































































































SQLServerCentral


Search