Check if field contains special character in SQL(检查字段是否包含 SQL 中的特殊字符)
问题描述
我们决定使用Nvarchar在一些表中存储一些信息,原因是我们假设我们会有很多特殊字符,因为数据库包含法语和德语数据.
We decided to use Nvarchar to store some information in some tables, the reason is that we assumed that we will have a lot of special characters since the database contains French and German data.
在提取了一些数据后,我们估计整个运行的大小非常大(20 TB)
After extracting some of the data, we estimated the full run to have and extreamlly huge size (20 TB)
现在我们要检查每个表以查找是否找到了特殊字符,如果没有,则将类型从 NvarChar 更改为 Varchar
Now we would like to check every table to find if there are special characters found, if not then we change the type from NvarChar to Varchar
知道如何查询吗?
或者您认为优化尺寸的最佳方法是什么?
or what do you think the best way to optimize the size?
推荐答案
我自己不久前不得不解决这个问题:
Had to solve this a little while ago myself:
使用正则表达式:
LIKE '%[^a-zA-Z0-9]%'
要解决搜索表的问题,请尝试:我如何在 SQL Server 数据库中的任何地方找到一个值? ,如果没有,我会在我使用的某个地方找到一个更好的值.
To solve the problem of searching the tables, try: How do I find a value anywhere in a SQL Server Database? , if not I got a better one somewhere that I use.
这篇关于检查字段是否包含 SQL 中的特殊字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:检查字段是否包含 SQL 中的特殊字符
基础教程推荐
- 将 SQL Server DateTime 列迁移到 DateTimeOffset 2021-01-01
- SQL:使用来自具有相同列名的两个表中的数据... 2021-01-01
- 在 SQL 中连接多个表 2021-01-01
- SSMS 中的权限问题:“对象 'extended_properties'、数据库 'mssqlsystem_resource'、... 错误 229)上的 SELECT 权限被拒绝" 2022-01-01
- 需要 MySQL 5.1 中的抽象触发器来更新审计日志 2021-01-01
- 是否可以执行按位分组功能? 2021-01-01
- SQL Server 实例在登录协商期间返回无效或不受支持的协议版本 2021-01-01
- 无法解决整理冲突 2021-01-01
- 如何使用 mysql.connector 禁用查询缓存 2022-01-01
- SQL 效率:WHERE IN 子查询 vs. JOIN 然后 GROUP 2021-01-01
