Morpheus1981
Programmer
This is what I am trying to do, I wanted to get a month name in diferent laguages so Created a function and resets the language, but it seems I cannot use any SET instruction into fuctions in SQL Server does anyone know a way to do this without doing it manually... I mean out my Function
CREATE FUNCTION spGenNombreMes
(@tnumMes Numeric(2,0),
@tindIngles numeric(1,0) = 0) RETURNS VARCHAR(30)
AS
BEGIN
DECLARE
@lnNumMes numeric(2,0),
@lcNombreMes VARCHAR(15),
@lcOldIdiom VARCHAR(12)
select @lcOldIdiom = @@LANGUAGE
IF @tindIngles = 0
SET LANGUAGE 'SPANISH'
ELSE
SET LANGUAGE 'US_ENGLISH'
select @lcNombreMes = datename(month,DATEADD(month, @tnumMes , '12/01/2002'))
SET LANGUAGE @lcOldIdiom
return @lcNombreMes;
END
CREATE FUNCTION spGenNombreMes
(@tnumMes Numeric(2,0),
@tindIngles numeric(1,0) = 0) RETURNS VARCHAR(30)
AS
BEGIN
DECLARE
@lnNumMes numeric(2,0),
@lcNombreMes VARCHAR(15),
@lcOldIdiom VARCHAR(12)
select @lcOldIdiom = @@LANGUAGE
IF @tindIngles = 0
SET LANGUAGE 'SPANISH'
ELSE
SET LANGUAGE 'US_ENGLISH'
select @lcNombreMes = datename(month,DATEADD(month, @tnumMes , '12/01/2002'))
SET LANGUAGE @lcOldIdiom
return @lcNombreMes;
END