473,405 Members | 2,444 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Remove Characters in MSSQL record

Is there a way to basically trim off the last X characters in a field?

Example

Field 1 Value - 15000
Field 2 Value - 2645678

Desired output - 15
Desired output - 2645

Can I perform a trim or something to remove the last 3 or X number of characters?

I know that I can RTRIM for spaces, but I wanted to trim the actual characters.

Thanks in advance!
May 4 '07 #1
2 8644
iburyak
1,017 Expert 512MB
Try this:

[PHP]
select substring(cast(2645678 as varchar(20)), 1, len(cast(2645678 as varchar(20))) - 3)[/PHP]

Good Luck
May 4 '07 #2
--Try this

select LEFT (your_column, LEN(your_column)-3) from your_table
May 7 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Ram | last post by:
We are trying to load text tab delimited files into SQL server using informatica 5.1 version. The text files are FTPed to a local server and then files are moved to applicable folder before...
3
by: gregofiesh | last post by:
Is there a way using ADO.NET to lock a record so that you can perform an atomic Test and Set operation on one of its fields? I want to set an application level lock bit on a record's field (set...
1
by: PMCG | last post by:
Hi I am using the XMLSerializer class to serialize a custom class into a memory stream whose contents i then pass to a MSSQL SP that uses the sp_xml_preparedocument SP, i can serialize the class but...
14
by: Kukurydz | last post by:
I've got such problem: My database is stored on MSSQL Server. I have to write reports for it in MSAccess. I've got a problem with creating a query which will select records from MSSQL table with...
4
by: Kivanc Toker | last post by:
Hi, I've got a problem with displaying texts with turkish characters. There is a website administration system, which is developed using ASP (VBScript) and ADO. This system is being used for...
4
by: kenneth.osenbroch | last post by:
Hi, I have a MSSQL Server communicating with an Oracle database through a MSSQL linked server using a MS ODBC connection. If I query the Oracle database through the Oracle ODBC 32Bit Test, the...
8
by: eugenio | last post by:
Hi...not sure if this is the right group for this posting, but i'm don't know where else to post. I've got a simple problem...I have a linux box running apache 2.0 and php5. I'm trying to use the...
4
by: ThePhenix | last post by:
Hi everybody, I have recently been doing a conversion for my boss for a access 2000 database (both front and backend) to a MSSQL backend. I finished the conversion today (as quite a lot of the...
2
Ciary
by: Ciary | last post by:
hi all, i just encountered a strange problem. on one of my php pages, i'm using a mssql database. the problem wasn't connecting buut after it i tried this: $id =...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.