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 中的特殊字符


基础教程推荐
- ERROR 2006 (HY000): MySQL 服务器已经消失 2021-01-01
- 如何在 SQL Server 的嵌套过程中处理事务? 2021-01-01
- SQL Server 2016更改对象所有者 2022-01-01
- 将数据从 MS SQL 迁移到 PostgreSQL? 2022-01-01
- 无法在 ubuntu 中启动 mysql 服务器 2021-01-01
- Sql Server 字符串到日期的转换 2021-01-01
- SQL Server:只有 GROUP BY 中的最后一个条目 2021-01-01
- 使用pyodbc“不安全"的Python多处理和数据库访问? 2022-01-01
- 在 VB.NET 中更新 SQL Server DateTime 列 2021-01-01
- SQL Server 中单行 MERGE/upsert 的语法 2021-01-01