You are here: Re: Querying a column with brackets in its name « MsSQL Server « IT news, forums, messages
Re: Querying a column with brackets in its name

Posted by Erland Sommarskog on 10/01/91 11:42

Usulnet (gdca@sbcglobal.net) writes:
> I was hoping someone has experienced this before, I'm having trouble
> googling this. I'm working with a poorly writtend database that has some
> fields named as such: MTIC_PROD_VEND[ 1]
>
> I do not have the option to rename this field but I do need to retreive
> data from it with SQL. I've tried a suggestion of [MTIC_PROD_VEND[ 1]]]
> and that doesn't seem to work, it may be because the 1 has a space
> leading it. Does anyone happen to have any suggestion to try to work
> around this? Any assistance would be greatly appreciated. Thanks.

[MTIC_PROD_VEND[ 1]]] should indeed be what you need; you need to double
the closing delimiter to include in the string. What exactly do you mean
with "doesn't seem to work"?

Stu's suggestioned to use "" certatinly looks cleaner anyway.



--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация