SQL : caractere româneşti

Lucrăm cu Microsoft SQL Server 2014 Enterprise (thanks, MSDNAA).

Caractere româneşti.

Descărcaţi codulPentru vizualizare, folosiţi scrollbar-ul din josul blocului de cod.
--caractere Unicode
USE [tempdb];

IF OBJECT_ID( 'dbo.TabelCaractere','U' ) IS NOT NULL
   DROP TABLE dbo.TabelCaractere;
CREATE TABLE dbo.TabelCaractere(
   contor BIGINT IDENTITY(0,1),
   caracter NCHAR DEFAULT('0') NOT NULL
   CONSTRAINT PK_contor PRIMARY KEY(contor)
);
GO

DECLARE @iterare AS BIGINT = 0;
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
BEGIN TRAN;
SET NOCOUNT ON;
  WHILE @iterare <= 65535
   BEGIN
     INSERT INTO dbo.TabelCaractere(caracter)
       VALUES(NCHAR(@iterare));
     SET @iterare += 1;
   END
SET NOCOUNT OFF;
COMMIT TRAN;
SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
GO

SELECT *
FROM dbo.TabelCaractere
WHERE contor BETWEEN 100 AND 400;
GO


--caractere romanesti
USE [master];

IF OBJECT_ID( 'dbo.TabelCaractereRom','U' ) IS NOT NULL
   DROP TABLE dbo.TabelCaractereRom;
CREATE TABLE dbo.TabelCaractereRom(
   contor BIGINT NOT NULL,
   caracter NCHAR DEFAULT('0') NOT NULL,
   CONSTRAINT PK_contorRom PRIMARY KEY(contor)
);
GO

--popularea tabelului
INSERT INTO dbo.TabelCaractereRom(contor,caracter)
 VALUES(259,NCHAR(259)),
 (226,NCHAR(226)),
 (238,NCHAR(238)),
 (351,NCHAR(351)),
 (355,NCHAR(355)),
 (206,NCHAR(206)),
 (350,NCHAR(350)),
 (354,NCHAR(354));
 GO

--procedura stocata de apelare
IF OBJECT_ID( 'dbo.usp_listarecarrom','P' ) IS NOT NULL
   DROP PROC dbo.usp_listarecarrom;
GO
CREATE PROC dbo.usp_listarecarrom
AS
SET NOCOUNT ON;
IF OBJECT_ID( 'dbo.TabelCaractereRom','U' ) IS NOT NULL
  SELECT caracter AS [Caracterul],
         contor AS [Codul sau]
  FROM dbo.TabelCaractereRom
  ORDER BY caracter;
SET NOCOUNT OFF;  
GO

--vizualizarea caracterelor romanesti
USE [master];

EXEC dbo.usp_listarecarrom;
GO