Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
dupati1
Posting Yak Master
123 Posts |
Posted - 2003-10-03 : 16:12:37
|
| Hi all,I have a table named OR Record and one of the columns it has is "Name of Surgeon"Now my question is how can i write a SQL query if have spaces in the name of the table and also in the name of columns.Is there anyway i get around around these problems or do i have to compulsorily change my table and column names.??Example:If i query something like SELECT Name of Surgeon from OR Record;its not working because of the spaces in the names of table and column. Any suggestions.Thanks in advance.VJ |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2003-10-03 : 16:15:07
|
| Well you should change the names. But you just need to put brackets around them:SELECT [Column Name]FROM [Table Name]Tara |
 |
|
|
dsdeming
479 Posts |
Posted - 2003-10-06 : 08:40:49
|
| There's more than just spaces going on here. Your industry-standard acronym for operating room has run headlong into SQL Server's reserved words.SELECT * FROM OR Record generates the following error message: Incorrect syntax near the keyword 'OR'. Tara is right, brackets will solve the problem.Dennis |
 |
|
|
X002548
Not Just a Number
15586 Posts |
Posted - 2003-10-06 : 11:16:54
|
Yeah..but even though this isn't a cross post...damn sure is close...RE-ENGINEER THE WHOLE DAMN THING!ACCESS S_CKSSELECT REPLACE(COLUMN_NAME,' ','_') FROM INFORMATION_SCHEMA.Columns Brett8-)SELECT @@POST FROM Brain ORDER BY NewId()That's correct! It's an AlphaNumeric! |
 |
|
|
|
|
|