I've noticed that when I use SSMS to import an Excel spreadsheet into SQL Server quotation marks are added. I've read somewhere that for whatever reason it's necessary for Excel to do this. Once in SQL Server, these quotes around the column names are useless and I'd like to have a programmatic way to remove them. The closest thing, which doesn't work, that I have tried to make is EXEC sp_rename 'Table.["withquotes"]', NewColumnName, 'replace(Table.["withquotes",'"','']
. I'd like to loop through all of the column names in a table and use the replace
function wherever a those column names contain quotation marks. Is there a typical, idiomatic way to do this?
相关问题
- sql execution latency when assign to a variable
- What is the best way to cache a table from a (SQL)
- php PDO::FETCH_ASSOC doesnt detect select after ba
- Bulk update SQL Server C#
- SQL to Parse a Key-Value String
相关文章
- Entity Framework 4.3.1 failing to create (/open) a
- How to truncate seconds in TSQL?
- Code for inserting data into SQL Server database u
- SQL Server 2008 Change Data Capture, who made the
- Delete Every Alternate Row in SQL
- Linux based PHP install connecting to MsSQL Server
- SQL Azure Reset autoincrement
- How do we alias a Sql Server instance name used in
I believe this should help...
Just for the info, I had errors with the procedure of OzrenTkalcecKrznaric. After searching, it was due to absence of schema name. So here is my version, updated to include that schema name:
One can also generate the statements, to be then copied, pasted and executed:
(replace myDb and mySchema by your values)