Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
gjack0519
Starting Member
7 Posts |
Posted - 2014-06-13 : 16:59:29
|
I am trying to remove the 12th character from a nvarchar field.This number 057381890100005 would read05738189010005 after the removal. All values have a length of 16 and the 12th character can be any value of 0-9. Any Ideas?ThanksGJ |
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2014-06-13 : 17:04:18
|
SELECT STUFF('057381890100005', 12, 1, '')As a query:SELECT STUFF(myColumn, 12, 1, '') FROM myTable |
|
|
gjack0519
Starting Member
7 Posts |
Posted - 2014-06-13 : 17:25:18
|
PerfectI kept trying to use Substring and the len functions, but kept getting wrong results.Thanks |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2014-06-13 : 18:16:29
|
SELECT LEFT(Col1, 11) + RIGHT(Col1, 4)FROM dbo.Table1SELECT SUBSTRING(Col1, 1, 11) + SUBSTRING(Col1, 13, 4)FROM dbo.Table1 Microsoft SQL Server MVP, MCT, MCSE, MCSA, MCP, MCITP, MCTS, MCDBA |
|
|
|
|
|
|
|