Update table column for removing unwanted double quotes in SQL Server
I want to update table entries simultaneously for all columns in one go. Suppose in the table, there is one column EmployeeName with entries like "SAM", "Jhon" and so on... I need all this entries under its column should appear like SAM, Jhon only... Double quotes should not be there, please provide me query for the scenario. Thanks in advance
Use Replace Function as next:- update TableName set columnName= REPLACE(columnName,'"','') Demo:- Create table #Dummy (col varchar(100)) insert into #Dummy values ('"SAM", "Jhon", "Smith"') update #Dummy set col = REPLACE(col,'"','') select * from #Dummy Result:- SAM, Jhon, Smith
update table1 set column1 = case when column1 = 'entity1' then 'entity2' when column1 like '%entity3%' then 'entity4' else 'entity5' end
To remove left-most quote: UPDATE MyTable SET EmployeeName = SUBSTRING(EmployeeName, 2, LEN(EmployeeName)) WHERE LEFT(EmployeeName, 1) = '"' To remove right-most quote: UPDATE MyTable SET EmployeeName = SUBSTRING(EmployeeName, 1, LEN(EmployeeName)-1) WHERE RIGHT(EmployeeName, 1) = '"'
You can also use a simpler way to remove all the quotes. update MyTable set EmployeeName = replace(EmployeeName,'"','')
Why not try the Replace function. Syntax: REPLACE ( string_expression , string_pattern , string_replacement ) If your table consist the data with double quote in the column, you need to update the table with the following query; Update <tablename> Set <columnName> = REPLACE(<columnName>,'"','') where <ColumnWithUniqueVale> = <something> e.g Replace(EmployeeName,'"','')
MDX SSAS 2008 Last year calculation - Leap year issue
saving a VB timespan value in SQL database
test if an action it was an update in triggers
sql server clustered index on non unique keys
How to use MSSQL DSN as URL in DataSource.groovy
Value cannot be null, Parameter name: viewInfo
How to make recipient address dynamic ,so i can avoid making changes in SSIS package?
SQL Server 2005 - Check/Validate null values and add to results
Parse XML data in SQL Server 2012
Primary Key on existing data
Can't get SQL Server to start or connect to my local database engine through SSMS
Retrieve a uniform data sample from a table
Reading multiple records related to every record in the result set at a time
Schema Changes to Integrate Facebook and Google Login
file stream vs local save in sql server?
Pivot or transpose a table in SQL Server without GROUPING BY