{"id":641,"date":"2010-11-29T23:01:35","date_gmt":"2010-11-30T04:01:35","guid":{"rendered":"http:\/\/www.dpriver.com\/blog\/?p=641"},"modified":"2011-09-26T21:43:48","modified_gmt":"2011-09-27T02:43:48","slug":"sql-refactor-rename-column-and-table","status":"publish","type":"post","link":"https:\/\/www.dpriver.com\/blog\/2010\/11\/sql-refactor-rename-column-and-table\/","title":{"rendered":"SQL Refactor: rename column and table"},"content":{"rendered":"

We begin to introduce features of SQL Refactor since Version 3.2.0.
\nThe first feature we added in Version3.2.0 is rename column and table of SQL script.<\/p>\n

SQL Pretty Printer is able to rename column and table in complex SQL including nested subquery, joins, parameters in function call, stored procedures and anywhere in the SQL script.<\/p>\n

Usually, search and replace functions in the most modern editors can’t do this job well. Take the following SQL for example:<\/p>\n

    \r\nSELECT Persons.Name, Orders.Name\r\nFROM Persons\r\nLEFT JOIN Orders\r\nON Persons.P_Id=Orders.P_Id\r\nORDER BY Persons.Name\r\n<\/pre>\nIf you want to rename column Persons.Name to Persons.firstName, By using replace function in editor will replace all Name in this SQL script that also including Orders.Name which is incorrect.<\/p>\nBy using rename column feature in SQL Pretty Printer, it will be much easy and safe to rename Persons.Name in the select list and order by clause to Persons.firstName while leaving Orders.Name untouched.<\/p>\nHave a try of SQL Pretty Printer Now<\/a><\/p>\nScreen shots of this awesome features
    \n<\/p>\nRename column name
    \n<\/p>\nAfter rename column name
    \n<\/p>\n","protected":false},"excerpt":{"rendered":"We begin to introduce features of SQL Refactor since Version 3.2.0. The first feature we added in Version3.2.0 is rename column and table of SQL script. SQL Pretty Printer is able to rename column and table in complex SQL including nested subquery, joins, parameters in function call, stored procedures and anywhere in the SQL script. Usually, search and replace functions in the most modern editors can’t do this job well. Take the following SQL for example: SELECT Persons.Name, Orders.Name FROM Persons LEFT JOIN Orders ON Persons.P_Id=Orders.P_Id ORDER BY Persons.Name If you want to rename column Persons.Name to Persons.firstName, By using\u2026<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[24],"tags":[],"blocksy_meta":{"styles_descriptor":{"styles":{"desktop":"","tablet":"","mobile":""},"google_fonts":[],"version":5}},"yoast_head":"\nSQL Refactor: rename column and table<\/title>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\t\n\t\n\t\n