Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 742 Vote(s) - 3.48 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Remove the last character in a string in T-SQL?

#11
To update the record by trimming the last N characters of a particular column:

UPDATE tablename SET columnName = LEFT(columnName , LEN(columnName )-N) where clause
Reply

#12
Try It :

DECLARE @String NVARCHAR(100)
SET @String = '12354851'
SELECT LEFT(@String, NULLIF(LEN(@String)-1,-1))
Reply

#13
declare @string varchar(20)= 'TEST STRING'
Select left(@string, len(@string)-1) as Tada
output:

Tada
--------------------
TEST STRIN
Reply

#14
select left('TEST STRING', len('TEST STRING')-1)
Reply

#15
e.g.

DECLARE @String VARCHAR(100)
SET @String = 'TEST STRING'

-- Chop off the end character
SET @String =
CASE @String WHEN null THEN null
ELSE (
CASE LEN(@String) WHEN 0 THEN @String
ELSE LEFT(@String, LEN(@String) - 1)
END
) END


SELECT @String

Reply

#16
Try this

DECLARE @String VARCHAR(100)
SET @String = 'TEST STRING'
SELECT LEFT(@String, LEN(@String) - 1) AS MyTrimmedColumn
Reply

#17
Try this,





DECLARE @name NVARCHAR(MAX) SET @name='xxxxTHAMIZHMANI****'SELECT Substring(@name, 5, (len(@name)-8)) as UserNames

And the output will be like, THAMIZHMANI
Reply

#18
@result = substring(@result, 1, (LEN(@result)-1))
Reply

#19
Get the last character

Right(@string, len(@String) - (len(@String) - 1))

Reply

#20
I can suggest this -hack- ;).

select
left(txt, abs(len(txt + ',') - 2))
from
t;

[**SQL Server Fiddle Demo**](

[To see links please register here]

)
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through