Description
Properties
| Name | Value |
|---|---|
| ANSI Nulls ON | True |
| Quoted Identifier ON | True |
| Encrypted | False |
| Execute As | |
| Null on Null Input | False |
| Schema Bound | False |
| Assembly |
Parameters
1| Name | Data Type | Length | Description |
|---|---|---|---|
| (Result) | int | 4 |
SQL Script
Copy
SET QUOTED_IDENTIFIER, ANSI_NULLS ON
GO
CREATE OR ALTER FUNCTION dbo.PeriodoMenosTres
(
-- Add the parameters for the function here
)
RETURNS INT
AS
BEGIN
-- Return the result of the function
RETURN CONVERT(INT, CONVERT(VARCHAR(4),YEAR(DATEADD(MONTH,-3,GETDATE()))) + RIGHT('00' + CONVERT(VARCHAR(2),MONTH(DATEADD(MONTH,-3,GETDATE()))), 2))
END
GO
GO
CREATE OR ALTER FUNCTION dbo.PeriodoMenosTres
(
-- Add the parameters for the function here
)
RETURNS INT
AS
BEGIN
-- Return the result of the function
RETURN CONVERT(INT, CONVERT(VARCHAR(4),YEAR(DATEADD(MONTH,-3,GETDATE()))) + RIGHT('00' + CONVERT(VARCHAR(2),MONTH(DATEADD(MONTH,-3,GETDATE()))), 2))
END
GO