我知道使用 N'...'
我们可以将多语言数据插入 SQL Server。但我不知道如何将它与参数一起使用。请帮我..
我的代码是:
Alter proc proc_T_NewsAddUpdate
(
@Id bigint,
@Title nvarchar(500),
@Description nvarchar(1000),
@image nvarchar(200),
@DateOfNews datetime,
@CreatedBy bigint,
@ModifiedBy bigint,
@IsVisible int,
@IsDeleted int
)
as
if exists(select 1 from T_LatestNews where ID=@Id)
begin
Update t_LatestNews
set Titlle = N@Title,
DesCription = N@Description,
Image = N@image,
dateOfnews = @DateOfNews,
modifiedDate = GETDATE(),
ModifiedBy = @ModifiedBy,
Isvisible = @IsVisible,
isdeleted = @IsDeleted
where
ID=@Id
select 1
end
else
begin
insert into t_latestnews (Titlle, Description, Image, dateofnews, CreatedDate, ModifiedDate, CreatedBy, ModifiedBy, isvisible, isdeleted)
values(@Title, @Description, @image, @DateOfNews, GETDATE(), GETDATE(), @CreatedBy, @ModifiedBy, @IsVisible, @IsDeleted)
select 1
end
最佳答案
最简单的解决方案是将数据作为 NVARCHAR 数据类型插入表中,如下所示。
--创建表
CREATE TABLE TBL_LANG
(
LNAME VARCHAR(50),
LTXT NVARCHAR(100)
)
– 插入不同语言的“Hello World”
INSERT INTO TBL_LANG
VALUES ('English',N'Hello World')
INSERT INTO TBL_LANG
VALUES ('Hindi',N'हैलो दुनिया')
INSERT INTO TBL_LANG
VALUES ('Chines',N'你好世界')
INSERT INTO TBL_LANG
VALUES ('Urdu',N'ہیلو دنیا')
--查看表数据
SELECT * FROM TBL_LANG
关于sql-server - 如何使用 N 在 SQL Server 中插入多语言数据?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12999108/