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
 SQL Server 2005 Forums
 Transact-SQL (2005)
 How to change column name to valid sql column name

Author  Topic 

tamancha.1
Starting Member

37 Posts

Posted - 2010-06-22 : 10:02:58
select top 10 state/province, State/Province Name
from a.states

How to change "state/province", "State/Province Name" to valid column names in SQL

Sachin.Nand

2937 Posts

Posted - 2010-06-22 : 10:05:11
What do you mean by valid column names?


Limitations live only in our minds. But if we use our imaginations, our possibilities become limitless.

PBUH
Go to Top of Page

Bustaz Kool
Master Smack Fu Yak Hacker

1834 Posts

Posted - 2010-06-22 : 19:29:08
Check out sp_rename in BOL. I don't know if this is what you are looking for but it couldn't hurt.

=======================================
A couple of months in the laboratory can save a couple of hours in the library. -Frank H. Westheimer, chemistry professor (1912-2007)
Go to Top of Page

DonAtWork
Master Smack Fu Yak Hacker

2167 Posts

Posted - 2010-06-23 : 09:46:29
try wrapping the column names in brackets


S elect top 10 [state/province], [State/Province Name]
from a.states


http://weblogs.sqlteam.com/jeffs/archive/2008/05/13/question-needed-not-answer.aspx
How to ask: http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

For ultra basic questions, follow these links.
http://www.sql-tutorial.net/
http://www.firstsql.com/tutor.htm
http://www.w3schools.com/sql/default.asp
Go to Top of Page
   

- Advertisement -