can I give SQL Server database name with hyphen like abc-123?

后端 未结 4 1435
清歌不尽
清歌不尽 2021-01-17 10:31

I created a sql server database with name of abc-123, in that I created a table Emp, when I run like

select * from abc-123.emp;
I am gett
4条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-17 10:37

    Use [] round the database name:

    SELECT * FROM [abc-123].[dbo].emp;
    

    OR

    SELECT * FROM [abc-123].dbo.emp;
    

提交回复
热议问题