Home > Mobile >  How do I remove the first two characters of every row in this column using SQL?
How do I remove the first two characters of every row in this column using SQL?

Time:06-17

How do I remove the first two characters of every row in this column?

  Ticket Number
  J2F4T45T      
  J2J3J3J2
  J25TGYHJ2    
  J2FFJ2J2    
  J2MG8NGJ2

CodePudding user response:

If you are using MSSQL You can use STUFF like this to see how it works:

SELECT STUFF('0123456789',1,2,'')

And then with an update

UPDATE YOUR_TABLE SET YOUR_COLUMN = STUFF('YOUR_COLUMN',1,2,'')

if you were using mysql there is an similar function INSERT()

There are a few different ways to do this, you can play with SUBSTRING or even regular expressions depending on your database.

  •  Tags:  
  • sql
  • Related