Home Does creating a column name with brackets actually insert brackets in the column name?

# Does creating a column name with brackets actually insert brackets in the column name?

zero01alpha
1#
zero01alpha Published in 2017-12-06 13:57:06Z
 For example if I create a table like this: CREATE TABLE FIREARM_BUILD ( [SCOPE] VARCHAR(max) );  Do the brackets actually result in a column named [SCOPE]? Edit: I believe my question is not a duplicate because the question in "question" does not explicitly answer what I'm asking.
Katherine Elizabeth Lightsey
2#
Katherine Elizabeth Lightsey Reply to 2017-12-06 14:34:23Z
 I typically include brackets in field and type name definitions because when you script out an object that's what SSMS does, and it's easier to add a few than change a lot if you're aiming for consistency. If you're building an object name dynamically, such as below, you should probably include brackets because you don't really know that the underlying table/schema name is legal. That's obviously why SSMS does it as well. declare @object [NVARCHAR](1000) = QUOTENAME(OBJECT_SCHEMA_NAME(@@PROCID)) + N'.' + QUOTENAME(OBJECT_NAME(@@PROCID));  For the procedure [dbo].[Get Monthly Report] this results in a value for @object of N'[dbo].[Get Monthly Report]'. Had you not bracketed the names using QUOTENAME this would result in a value for @object of N'dbo.Get Monthly Report'. In certain scenario, such as dynamic sql, the second would fail.
 You need to login account before you can post.
Processed in 0.303707 second(s) , Gzip On .