Wrox Home  
Search P2P Archive for: Go

  Return to Index  

sql_language thread: Stored Procedure to rename table columns


Message #1 by "Gil Barden" <gil@s...> on Thu, 12 Apr 2001 13:53:15 -0700
I actually mean to replace them permanantly in the tables.

Best Regards,

Gil Barden
Certified ColdFusion Developer/Instructor
Microsoft Certified System's Engineer
xxx-xxx-xxxx  (Cell)
xxx-xxx-xxxx  (Office)
xxx-xxx-xxxx  (Office Fax)
gil@A...
www.AndrewsTechnology.com

-----Original Message-----
From: Breidenbach, Beth [mailto:Beth.Breidenbach@g...]
Sent: Thursday, April 12, 2001 2:27 PM
To: sql language
Subject: [sql_language] RE: Stored Procedure to rename table columns


Do you mean to replace the spaces for purposes of the result set, or to
actually change the name of the columns in the database itself?

If you're talking about replacing in the query's result set, this will work:

select replace(table_name,' ','_'), replace(column_name,' ','_') from
information_schema.columns

Beth Breidenbach
__________________________________________________
Beth Breidenbach, MCSD
Product Architect
Getronics
(xxx) xxx-xxxx
beth.breidenbach@g...

"A ship tied in port is safe, but that is not what ships are for.  Sail out
and do new things."
(Admiral Grace Hopper, Computer Pioneer)
__________________________________________________


-----Original Message-----
From: Gil Barden [mailto:gil@s...]
Sent: Thursday, April 12, 2001 1:53 PM
To: sql language
Subject: [sql_language] Stored Procedure to rename table columns


Can anyone help me out w/ the code to go through a MSSQL 2000 box and grab
all the table columns and change them from having a "space" to an
"underscore".

Example: d domain name = d_domain_name

Best Regards,

Gil Barden


  Return to Index