Freitag, 13. April 2012 20:54
will there be any issues if i name a table as dbo.[1table] , instead of naming it as just dbo.[table]
dbo.[1table] vs dbo.[table]
the reason i had to naem like that is i have 10 different tables with different names i want to order then based on their hierarchy
- Bearbeitet Dkuud Freitag, 13. April 2012 20:55
Freitag, 13. April 2012 20:57
You won't be able to refer to that table without the brackets, since SQL identifiers cannot start with numbers. You should use "table1" without brackets.
I get a sinking suspicion somehow that whatever you are doing with these tables is better done in some other method. Would you mind sharing your use case?
Freitag, 13. April 2012 21:00ModeratorHaving a table name that starts with a number will require usage of the  everywhere. I suggest to not use such convention in your code and always try to create names which abide to correct identifier rules and don't require brackets.
For every expert, there is an equal and opposite expert. - Becker's Law
Freitag, 13. April 2012 22:31starting a table name with a number is not a good idea. also, the name 1table is not very descriptive. Maybe think of a better table name?
Samstag, 14. April 2012 18:00
You are violating ANSI standards; we use the double quotes and not square brackets.
You are violating ISO standards; names never begin with digits or underscores. The name "table" is meta data and cannot be used as part of a table name in a schema.
You have a bad data model. Tables are sets of the same kind of entities; there is no hierarchy or sequence to them. We use descriptive table names instead.
That used to happen with magnetic tape file labels. Is that what you are doing!?
--CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking in Sets / Trees and Hierarchies in SQL
Samstag, 14. April 2012 18:13
I suggest you follow standard identifier naming conventions so you don't need to enclose object names. I don't know the details of your requirement but maybe a convention like dbo.t1_table will do the job.
Dan Guzman, SQL Server MVP, http://weblogs.sqlteam.com/dang/