Table links

In SQL Server, why is this:

[dbo].[table_name]

more preferable:

dbo.table_name

And on these lines, why even list dbo at all, if there is only one scheme?

+3
source share
10 answers

This is just in case you have a keyword as the tab name, for example [user]

+3
source

If the table name contains keywords, you will have to enclose it inside []. Most tools (like ORM) use this method to avoid errors or consistency.

+4
source

.

, , .

+3

- , , /.

+3

, , . [] , , sql. , , Select, SELECT * FROM [Select], SELECT * FROM Select.

+2

, , , .

dbo . , , . schema.table, , .

, dbo.user, . sql "", , , . , . "dbo.user" .

+1

[] , . , []. , , , .
dbo - ,

  • (. )
  • dbo , , . , .
  • , .
+1

"" , ?
, ..

0

, . SQL.

0

, , , , a .

.

:

, , , :

(~) , (-) (!), ({), (%), (}), (^), ('), (&), (.), ((), (), ()), (`),

( ) , , , . SQL Server dbo, , .

, SCHEMABINDING, .

Hope this helps

0
source

Source: https://habr.com/ru/post/1698750/


All Articles