declare @name nchar(128)
set @name='123'
select stuffname from huqiangdataset.dbo.T_stainlesssteelstuff where stuffname=@name
當@name中含有中文時就查詢不到結果,中文該怎麼處理
CREATE TABLE [T1] ([NAME] NVARCHAR(255))
GO
INSERT INTO [T1] VALUES(N'中國')
GO
INSERT INTO [T1] VALUES(N'北京')
GO
INSERT INTO [T1] VALUES(N'上海')
GO
SELECT * FROM [T1]
GO
DECLARE @NAME NCHAR(128)
SET @NAME = N'中國'
SELECT * FROM [T1] WHERE [NAME]=@NAME
GO
DROP TABLE [T1]
GO