If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ANSI SQL > Select stmt on Column Name that is also a system function name

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-12-04, 08:39
garethh garethh is offline
Registered User
 
Join Date: Aug 2004
Posts: 0
Select stmt on Column Name that is also a system function name

Does anyone know of a workaround to a problem where a select statement fails because a column name has the same name as a system function. The column name is "Current". For example:

1> SELECT Title from Books
2> WHERE Current = "New";
3> go
Msg -131, Level 0, State 0, Server library, Line 0
syntax error near '='
1>


The SQL Server is Sybase 5.5 on W2K - the related 'Current' naming problem is due to the Current Date function. For example

SELECT Current Date;
Aug 12 2004 12:00AM

I am trying to resolve this without modifying the Table Column name (Current) - I am a third party doing reporting from a database not developed by me so the database would need modifing.

Anyone have any ideas??

Gareth
Reply With Quote
  #2 (permalink)  
Old 08-13-04, 13:16
shab shab is offline
Registered User
 
Join Date: Jul 2004
Posts: 6
Try putting brackets around it like:

select [current] from ...
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On