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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 I hate to even ask....

Author  Topic 

btrimpop
Posting Yak Master

214 Posts

Posted - 2003-05-12 : 14:32:17
I've inherited porting an app and db that was originally written for SQL 7 (strictly) to SQL 2000 and one of the tables has a column (I shudder to think it) named "function".

So, of course being a reserved word the SQL 2000 install of the app crashes on the db create when it reaches creating.

The question as silly as it sounds: Is there a way to tell SQL 2000 to ignore the key word function (temporarily), in order to alter the table and change the column name?

For existing SQL 7 installations, BCP'ing the data out of 7 and back into a fixed table is not a great option, but if you tell me that's it, so be it.

Thanks

p.s. Pretty sure I know what the answer is going to be, but I love the validation!

"In theory there is no difference between theory and practice. But in practice there is!"



nr
SQLTeam MVY

12543 Posts

Posted - 2003-05-12 : 14:41:19
Try referencing it as [function]

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2003-05-12 : 14:43:59
it is actually no big deal at all. just put [] around the word function and you are good to go.

select [function]
from
yourTable

Many reserved words in SQL are used as field names ("Group", "Order", "Name", etc.) -- happens all the time.





- Jeff
Go to Top of Page

btrimpop
Posting Yak Master

214 Posts

Posted - 2003-05-12 : 14:45:42
ahhhhhh!!! It's always the simple solution staring you in the face, been there, done that, completely spaced it...

Thanks nr!!

"In theory there is no difference between theory and practice. But in practice there is!"



Go to Top of Page

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2003-05-12 : 14:48:38
Sorry Nigel ... you got me by 2 minutes !

- Jeff
Go to Top of Page
   

- Advertisement -