我在Dummy
表中找到了一个错误插入值"123"
的列。
如何从字段中的值中删除双引号,而在该字段中包含123.
帮帮我
感谢您的期待
答案 0 :(得分:3)
您可以使用T-SQL的replace
方法
将所有出现的指定字符串值替换为另一个字符串值。
UPDATE Dummy set myColumn = replace(myColumn,'"','')
答案 1 :(得分:2)
update dummy set your_field = replace(your_field, '"', '')
答案 2 :(得分:2)
USE [YourDataBase]
GO
/****** Object: UserDefinedFunction [Accounts].[fn_CurrentFeeorArrears] Script Date: 02/18/2014 12:54:15 ******/
/*****Developed By rameez****/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE FUNCTION [FN_REMOVE_SPECIAL_CHARACTER]
(
@INPUT_STRING varchar(max))
RETURNS VARCHAR(max)
AS
BEGIN
--declare @testString varchar(max),
DECLARE @NEWSTRING VARCHAR(max)
-- set @teststring = '$rameez$ali$'
SET @NEWSTRING = @INPUT_STRING ;
With SPECIAL_CHARACTER as
(
--SELECT '>' as item
--UNION ALL
--SELECT '<' as item
--UNION ALL
--SELECT '(' as item
--UNION ALL
--SELECT ')' as item
--UNION ALL
--SELECT '!' as item
--UNION ALL
--SELECT '?' as item
--UNION ALL
--SELECT '@' as item
--UNION ALL
--SELECT '*' as item
--UNION ALL
--SELECT '%' as item
--UNION ALL
SELECT '$' as item
)
SELECT @NEWSTRING = Replace(@NEWSTRING, ITEM, '') FROM SPECIAL_CHARACTER
return @NEWSTRING
END
select dbo.[FN_REMOVE_SPECIAL_CHARACTER] ('r$@ameez')