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
 General SQL Server Forums
 New to SQL Server Programming
 Problem using CURRENT

Author  Topic 

fuzzyjon
Starting Member

15 Posts

Posted - 2008-04-11 : 10:00:47
Hello,

I have a column in one of my tables called CURRENT. However, when I try to do a select on this column I get an error, I assume because CURRENT is also a SQL term.

Is there any way I can rename my CURRENT column (maybe using an alias?) within my SQL script? I am unable to change the column name within the database.

Thanks,

Jon

RyanRandall
Master Smack Fu Yak Hacker

1074 Posts

Posted - 2008-04-11 : 10:03:02
Use [CURRENT].


Ryan Randall
Solutions are easy. Understanding the problem, now, that's the hard part.
Go to Top of Page

fuzzyjon
Starting Member

15 Posts

Posted - 2008-04-11 : 10:59:57
Thanks Ryan!

Best wishes
Jon
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-04-11 : 12:04:27
Always make sure you enclose field names within square brackets if they happen to be SQL keyword.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-04-14 : 03:25:14
quote:
Originally posted by visakh16

Always make sure you enclose field names within square brackets if they happen to be SQL keyword or if it has spaces.



Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-04-14 : 03:48:31
Or begins with a digit.
Or has either [ or ] in the name.



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

Lumbago
Norsk Yak Master

3271 Posts

Posted - 2008-04-14 : 03:56:57
...or just use names that are not reserved words!

--
Lumbago
Go to Top of Page
   

- Advertisement -