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
 General SQL Server Forums
 New to SQL Server Programming
 Quotes question

Author  Topic 

Bill_C
Constraint Violating Yak Guru

299 Posts

Posted - 2009-08-27 : 02:29:06
Problem:-
I get sent csv files from clients, these files have been created from Access databases and all have quotes around field names and their contents.
I have no control on the creation of these files, and i have to import them into our systems (sql server 2005).

I normally use the import wizard to import them into our system.

My question is:-
Is there a way of removing the quotes "" (programatically?) from the field names once i have imported the data?
(other than opening the table in design mode and manually doing it)

senthil_nagore
Master Smack Fu Yak Hacker

1007 Posts

Posted - 2009-08-27 : 02:41:43
Here it is

EXEC sp_rename '<table_name>.''old_columnname''', new_column_name, 'COLUMN'

Senthil.C
------------------------------------------------------
[Microsoft][ODBC SQL Server Driver]Operation canceled

http://senthilnagore.blogspot.com/
Go to Top of Page

Bill_C
Constraint Violating Yak Guru

299 Posts

Posted - 2009-08-27 : 02:54:56
Thanks, I'll give it a shot
Go to Top of Page

senthil_nagore
Master Smack Fu Yak Hacker

1007 Posts

Posted - 2009-08-27 : 03:04:53
Welcome

Senthil.C
------------------------------------------------------
[Microsoft][ODBC SQL Server Driver]Operation canceled

http://senthilnagore.blogspot.com/
Go to Top of Page
   

- Advertisement -