Search code examples
sqlsql-serverdatabaserdbms

Change multiple column names in SQL view


I am using SQL Server 2012. I have created a View but I have done one mistake. I added columns like Column_Name1 Column_Name2..........

But I had to add them like Column Name1 Column Name2........

There are about 300 columns so I need a way to replace _ by white space in column names. Please suggest me fast way.

Edit

People are down voting without any reason, I guess because it is the view of 300 columns, forget about view. What if it would be a table?

Thanks


Solution

  • GO TO SSMS->Server->YourDataBAse->Views->Select your view->(Right click)-> SCRIPT VIEW AS -> ALTER TO -> New Query Window. Then use the basic CTRL+H for Search and Replace. Then Run the Script.

    Hope I understood right what you want. This is the easy and fast way.