检查字段是否包含 SQL 中的特殊字符 [英] Check if field contains special character in SQL

查看:48
本文介绍了检查字段是否包含 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 中的特殊字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆