How to Retrieve the Column Name which has space in SQL Server

Use this simple code to find the name of those columns from the database which has spaces in their names.

CODE



SELECT o.name, c.name
FROM sysobjects o INNER JOIN syscolumns c ON o.id = c.id AND o.xtype = 'U'
WHERE (o.name = 'TableName') and c.name like '% %'


Comments

Author: Mrs. Meetu Choudhary Nanda06 Jun 2009 Member Level: Gold   Points : 1

Please use proper resource category.
for this kind of code snippets use tips instead of code snippet.

++
Thanks and Regards
Meetu Choudhary
Editor

Author: Manoranjan Sahoo06 Jun 2009 Member Level: Gold   Points : 0

Ok. I will do from next time.

Thank You for inform me.



  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: