| Forum Home | ||||
| Press F1 | ||||
| Thread ID: 130223 | 2013-04-02 00:04:00 | SQL view removing spaces from Field Names | Mike (15) | Press F1 |
| Post ID | Timestamp | Content | User | ||
| 1335016 | 2013-04-02 00:04:00 | Hi, I am accessing some tables in SQL (SQL Server 2008) that have spaces in both the table name. and the field names. Is it possible to create a view to a table that removes the spaces from the field names, without me having to type in ever field name to make it happen? I cannot modify the source database, so will need to be a view on my own database (also SQL 2008). Cheers, Mike. |
Mike (15) | ||
| 1335017 | 2013-04-06 21:51:00 | Do you want to create a view, showing data from another database ? | Chasseur2lapin (17049) | ||
| 1335018 | 2013-04-07 01:43:00 | Do you want to create a view, showing data from another database ?Yes. I need to create approximately 60 views, each to a matching table in the other database. The fields in the master DB have spaces, I need my views to have no spaces. Cheers, Mike. |
Mike (15) | ||
| 1335019 | 2013-04-07 20:32:00 | You can probably do something by querying the INFORMATION_SCHEMA.Tables and INFORMATION_SCHEMA.Columns views to generate the CREATE VIEW statements for you. | somebody (208) | ||
| 1335020 | 2013-04-07 22:07:00 | So if you have a database called "clientdata" wiith two columns labelled "First Name" and "Last Name", you could do something like: SELECT 'First Name' as 'Firstname', 'Last Name' as 'Surname' from clientdata ? |
Chilling_Silence (9) | ||
| 1 | |||||