sql语句中的[]括号 [英] [] brackets in sql statements

查看:160
本文介绍了sql语句中的[]括号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

括号在sql语句中做什么?

What do the brackets do in a sql statement?

例如,在语句中:

insert into table1 ([columnname1], columnname2) values (val1, val2)

如果表名放在方括号中,该怎么办?

Also, what does it do if the table name is in brackets?

推荐答案

[]标记标识符的分隔符,因此,如果您的列名称包含空格(如订购数量),则需要用[]括起来:

The [] marks the delimitation of a identifier, so if you have a column whose name contains spaces like Order Qty you need to enclose it with [] like:

select [Order qty] from [Client sales]

它们还将转义用作标识符的保留关键字

They are also to escape reserved keywords used as identifiers

这篇关于sql语句中的[]括号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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