zoukankan      html  css  js  c++  java
  • 解决 SQL 不能正确显示中文问题

    use DataBaseName
    go
    if not OBJECT_ID('[Employees]') is Null
       Drop Table [Employees]
    go
    Create Table [Employees]
    (ID int Primary Key Identity(1,1),
     [Name] Nvarchar(50) Not Null,
     [Title] Nvarchar(50) Null,
     [Phone] int Null,
     [City] Nvarchar(20))
     go
     Insert Into [Employees] 
     select '张三', '采购经理', 1234567, '北京'
     Union All
     select '李四', '销售', 7654321, '上海'
     Union All
     select '王小', '前台', 1230000, '上海'
    
     select * from [Employees] where [City] = '上海'
    View Code

    结果显示:

     不改变排序规则和字段类型,加 N 解决:

    use DataBaseName
    go
    if not OBJECT_ID('[Employees]') is Null
       Drop Table [Employees]
    go
    Create Table [Employees]
    (ID int Primary Key Identity(1,1),
     [Name] Nvarchar(50) Not Null,
     [Title] Nvarchar(50) Null,
     [Phone] int Null,
     [City] Nvarchar(20))
     go
     Insert Into [Employees] 
     select N'张三', N'采购经理', 1234567, N'北京'
     Union All
     select N'李四', N'销售', 7654321, N'上海'
     Union All
     select N'王小', N'前台', 1230000, N'上海'
    
     select * from [Employees] where [City] = N'上海'
    View Code

    结果显示:

  • 相关阅读:
    类和对象的一些BIF
    mac入门--通过hhomebrew下载过慢问题
    Vue的组件及传参
    Vue的指令和成员
    Vue基础(1)
    Python中好用的模块们
    Django-Auth认证模块
    Django杂篇(2)
    Django杂篇(1)
    Django的日常-AJAX
  • 原文地址:https://www.cnblogs.com/endless-on/p/3172024.html
Copyright © 2011-2022 走看看