February 28, 2022

Update first 2 characters in SQL

DECLARE @ReplaceString CHAR(2) SET @ReplaceString = 'C:' UPDATE [DATABASENAME].[dbo].[TABLENAME] SET TABLENAME= REPLACE(TABLENAME, LEFT(TABLENAME, 2),@ReplaceString) WHERE LEFT(TABLENAME,2) = 'P:'
Update first 2 characters in SQL
This website uses cookies to improve your experience. By using this website you agree to our Data Protection Policy.
Read more