Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8463607
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T14:30:09+00:00 2026-06-10T14:30:09+00:00

Possible Duplicate: trim left characters in sql server? I have a query below that

  • 0

Possible Duplicate:
trim left characters in sql server?

I have a query below that grabs customer information from our database to send coupons. In regards to the ZIP code, we only want the first 5 digits of the field… How can I return ONLY the first 5? My code is below:

SELECT        Invoice_Tb.Customer_First_Name AS firstname, Invoice_Tb.Customer_Last_Name AS lastname, Invoice_Tb.Customer_Address AS add1, Invoice_Tb.City, 
                         Invoice_Tb.Customer_State AS State, Invoice_Tb.ZIP_Code AS ZIP, Invoice_Tb.Customer_Email_Address AS [Email Address], 
                         Invoice_Tb.Vehicle_Mileage AS [Vehicle Mileage], Invoice_Tb.Invoice_Date AS [Date Of Service], Invoice_Tb.Store_Number, @startdate AS Start_Date, @enddate AS End_Date
FROM            Invoice_Detail_Tb INNER JOIN
                         Invoice_Tb ON Invoice_Detail_Tb.Invoice_Number = Invoice_Tb.Invoice_Number AND Invoice_Detail_Tb.Invoice_Date = Invoice_Tb.Invoice_Date
WHERE        (Invoice_Detail_Tb.Store_Category_Code = 'FS') AND (Invoice_Tb.Invoice_Date BETWEEN CONVERT(DATETIME, @startdate, 102) AND CONVERT(Datetime, 
                         @enddate, 102)) AND (Invoice_Tb.Reminder_Mail_Flag = 'Y')
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T14:30:10+00:00Added an answer on June 10, 2026 at 2:30 pm

    Try

    LEFT(FieldName, 5)
    

    e.g.

    SELECT LEFT(FieldName, 5) as SomeAlias FROM SomeTable
    

    Table:

    FieldName
    ---------
    Hello World
    

    Result:

    SomeAlias
    ---------
    Hello
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Extracting dollar amounts from existing sql data? I have a column in
Possible Duplicate: How to trim whitespace from bash variable? I have searched and attempted
Possible Duplicate: regex for URL including query string I have a text or message.
Possible Duplicate: How to call a JavaScript function from PHP? I have a php
Possible Duplicate: Trim spaces from start and end of string I would like to
Possible Duplicate: Why do I get a null pointer exception from TabWidget? I have
Possible Duplicate: (Django) Trim whitespaces from charField In ruby on rails is really easy
Possible Duplicate: Best way to prevent SQL injection? For logging in: $username = mysql_real_escape_string(htmlspecialchars(strip_tags(trim($_POST['username'])),
Possible Duplicate: remove multiple whitespaces in php I have a stream of characters, a
Possible Duplicate: Is there a way to create a SQL Server function to “join”

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.