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 |
|
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. |
 |
|
|
fuzzyjon
Starting Member
15 Posts |
Posted - 2008-04-11 : 10:59:57
|
| Thanks Ryan!Best wishesJon |
 |
|
|
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. |
 |
|
|
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.
MadhivananFailing to plan is Planning to fail |
 |
|
|
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" |
 |
|
|
Lumbago
Norsk Yak Master
3271 Posts |
Posted - 2008-04-14 : 03:56:57
|
| ...or just use names that are not reserved words!--Lumbago |
 |
|
|
|
|
|