Re: Freaking column names



How about this? Rather than a stored procedure, generate a script to
run against all of your columns, like so:

SELECT 'exec sp_rename ''' + Table_Name + '.'
+ Column_name + ''', ''' +
REPLACE(COLUMN_NAME, '-', '') + ''', ''COLUMN'''
FROM INFORMATION_SCHEMA.COLUMNS
WHERE COLUMN_NAME LIKE '%-%'

Cut and paste the results of the query into a new QA window and execute
the statements.

HTH,
Stu

.



Relevant Pages

  • Code for Scripts
    ... I'm looking for code that will create a script of a stored procedure vs. ... going through the gui. ... Prev by Date: ...
    (microsoft.public.sqlserver.mseq)
  • Re: Freaking column names
    ... Stu wrote: ... the above command will NOT execute the stored procedure; ... > You have to cut and paste that script into a new window in query ... > analyzer to actually execute the changes. ...
    (comp.databases.ms-sqlserver)
  • Code for creating SQL Scripts
    ... I'm looking for some code that can be run in query analyzer that will produce ... a script for a view, table or stored procedure vs. going through the gui to ... Prev by Date: ...
    (microsoft.public.sqlserver.mseq)
  • Code for SQL Scripts
    ... I'm trying to acquire code that produces a script of a stored procedure, ... I would like to run this code through a query window vs. ... Prev by Date: ...
    (microsoft.public.sqlserver.mseq)
  • Re: composite key question
    ... Each time you do an insert SQL ... it's probably not a stored procedure. ... queries to perform slower, however. ... Seeing as how that script you sent was not a stored proc, ...
    (microsoft.public.sqlserver.programming)