Skip to navigation
How to clean non Alpha characters from my mssql table RemoveNonAlphaCharacters
01.04.14
USE [SL] GO /****** Object: UserDefinedFunction [dbo].[RemoveNonAlphaCharacters] Script Date: 4/1/2014 4:14:04 PM ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO ALTER Function [dbo].[RemoveNonAlphaCharacters](@Temp VarChar(1000)) Returns VarChar(1000) AS Begin Declare @KeepValues as varchar(50) Set @KeepValues = '%[^a-zA-Z0-9-._ !()*/\]%' While PatIndex(@KeepValues, @Temp) > 0 Set @Temp = Stuff(@Temp, PatIndex(@KeepValues, @Temp), 1, '') Return @Temp End than my python command called it like con = pymssql.connect(host=self.parent.host, user=self.parent.user, password=self.parent.password, database=self.parent.database) c = con.cursor() c.execute("UPDATE sl.dbo.av0_style SET av0_description = sl.dbo.RemoveNonAlphaCharacters(av0_description)") con.commit()
Reply
Anonymous
Information Epoch 1732528778
ACID (Atomicity, Consistency, Isolation, and Durability)
Home
Notebook
Contact us