|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Stored Procedures - String split stored procedure
I have a nvarchar field. The field has spaces in no particlar format. I have used replace function to get rid of the spaces & to get a continuous string.
But I need to take its last 3 characters and insert a space between first n characters & last 3 So if the string is ABCDEFG-I want ABCD EFG if the string is ABCDEFGH-I want ABCDE FGH etc How do i write a stored procedure to do this |
|
#2
|
|||
|
|||
|
SELECT
CASE WHEN LEN(column) > 3 THEN SUBSTRING(column,1,LEN(column)-3) + ' ' + SUBSTRING(column,LEN(column)-2,3)) ELSE 'Too short' END FROM table |
![]() |
| Viewing: ASP Free Forums > Database > Microsoft SQL Server > Stored Procedures - String split stored procedure |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|