• Post Reply Bookmark Topic Watch Topic
  • New Topic

how to access hyphenated database in MSSQL

 
rb kl
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
In MSSQL im not able to access the table from database which has the hyphenated name(example -database name is Temp-db).

& in MSSQL im not able to create the table with hyphenated name.


Thanks for your help in advance.

thanks,
rbkl
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hyphenated table names are possible in SQL Server, if a little ill-advised becuase they are awkward to work with. If you have created one you will need to use the [ ] escape characters to stop SQL Server interpreting the - as a minus symbol. e.g.:
 
rb kl
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your reply.
Im able to create,insert,select the table by using your code.

But i already have the database name with hyphanated.i'm not able to access tables from that databse.


regards
rbkl
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!