Groups | Blog | Home
all groups > sql server clients > april 2006 >

sql server clients : '[' in column name


Carmen
4/18/2006 11:28:02 AM
I'm running a OpenRowset query getting data from MSAS (MSOLAP). The query
returns column names such as '[Time Period].[BTG][Measures].[FC]'. I need to
create an alias for this column. How could I do it? I tried '[[Time
Period].[BTG][Measures].[FC]]', '[[Time Period]].[[BTG]][[Measures]].[[FC]]',
and other combinations but nothing so far. Anybody can help?

Thanks,

Steve Kass
4/24/2006 1:17:30 AM
You'll see the correct way to specify this with the
function QUOTENAME():

select quotename('[Time Period].[BTG][Measures].[FC]')

The result is
[[Time Period]].[BTG]][Measures]].[FC]]]

You could also use
"[Time Period].[BTG][Measures].[FC]"

When using [] to delimit an object name, you must
double any occurrences of ] in the name. Don't
double the occurrences of [ .

Steve Kass
Drew University


[quoted text, click to view]
AddThis Social Bookmark Button