SQL Server Replace Multiple Spaces in String with Single Space:
To replace multiple spaces in string with single space in sql server
we need to write
the query like this
Select REPLACE(REPLACE(REPLACE(@str,' ','{}'),'}{',''),'{}',' ')
Example:
DECLARE @str varchar(150)
SET @str='Hello Welcome to Aspdotnet-suresh.com'
Select REPLACE(REPLACE(REPLACE(@str,' ','{}'),'}{',''),'{}',' ')
SQL Server - How to Remove Special Characters from String in SQL Server 2008:
DECLARE @regex INT,@string varchar(100)
SET @string='welcome-to''aspdotnet=sures@h.com##39;
SET @regex = PATINDEX('%[^a-zA-Z0-9 ]%', @string)
WHILE @regex > 0
BEGIN
SET @string = STUFF(@string, @regex, 1, ' ' )
SET @regex = PATINDEX('%[^a-zA-Z0-9 ]%', @string)
END
SELECT @string
SQL Server - How to Change (Reseed) Identity Column Value in SQL Server 2008:
DBCC CHECKIDENT (Table_Name, RESEED, New_Reseed_Value)
: DBCC CHECKIDENT ('UserDetails', RESEED, 500)
No comments:
Post a Comment