Friday, December 09, 2011

Foreign Language Months and Days syslanguages f

SELECT * FROM sys.syslanguages
GO

DECLARE @langid int = 6 -- Italian

-- use row_number without an order by using (select 0) ...
-- needed for dropdownlist select options where value =id (row_number)

-- create two temporary tables with bogus row numbers as ID then join them together

SELECT row_number() over(order by (select 0)) AS [ID]
, item AS [ShortMonth]
, CAST(N'' AS nvarchar(20)) AS [Month]
INTO #T
FROM [dbo].[CSV2Table]( (SELECT shortmonths
FROM sys.syslanguages
WHERE langid= @langid)
, ',') 

SELECT row_number() over(order by (select 0)) AS [ID]
, item AS [Month]
INTO #T2
FROM dbo.[CSV2Table]( (SELECT months
FROM sys.syslanguages
WHERE langid= @langid)
, ',')

 
-- Perform an INNER JOIN Update based on the bogus IDs

UPDATE #T SET Month = #T2.Month
FROM #T2 INNER JOIN #T ON #T2.ID = #T.ID

SELECT * FROM #T

DROP TABLE #T
DROP TABLE #T2


Young Roofers

Young Roofers
Men Making

Fly. Be Free.

Fly. Be Free.
Man Ready to Hang ... Glide

Burke

Burke
A Man in the Making - 12 years old

Blackwater

Blackwater
A Man in the Mud