如何从数字开始创建列名 [英] How to create a column name starting from numeric
本文介绍了如何从数字开始创建列名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在sql中创建这样的列名
897455X7X35 char(1)DEFAULT NULL,
我是什么尝试过:
897455X7X35 char(1)DEFAULT NULL,
解决方案
是的,你可以做到这一点。您所要做的就是将列名包装在括号中。请参阅下面的代码。
ALTER 表员工
ADD [897455X7X35] char ( 1 ) DEFAULT NULL ;
通常,以非字母字符开头命名表列是一种不好的做法。话虽如此,您应该能够将列名括在大括号中(就像在SELECT查询示例中一样)。
见下面的查询摘要
ALTER 表员工 ADD [897455X7X35] char ( 1 ) DEFAULT NULL ;
how to create a column name like this in sql
897455X7X35 char(1) DEFAULT NULL,
What I have tried:
897455X7X35 char(1) DEFAULT NULL,
解决方案
Yes, you can do that. All you have to do is wrap the column name in brackets. Please see code below.
ALTER TABLE Employee ADD [897455X7X35] char(1) DEFAULT NULL;
Normally, it's a bad-practice to name a table column starting with non-alphabet characters. Having said that, you should be able to enclose your column name in braces (like in your SELECT query example).
see below query snippet
ALTER TABLE Employee ADD [897455X7X35] char(1) DEFAULT NULL;
这篇关于如何从数字开始创建列名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文