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 8264055
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T04:19:16+00:00 2026-06-08T04:19:16+00:00

I have run a query using Eclipse from a Sybase db. I need to

  • 0

I have run a query using Eclipse from a Sybase db. I need to eliminate duplicate entries but the results have mixed types – INT and TEXT. Sybase will not do distinct on TEXT fields. When I Save All results and paste that into Excel some of the TEXT field bleeds into the INT field columns – which makes Excel -Remove Duplicates tough to do.

I am thinking I might create an alias for my query, add a temp table, select the distinct INT column values from the alias and then query the alias again, this time including the TEXT values. Then when I export the data I save it into Word instead. It would look like this:

SELECT id, text
FROM tableA, TableB
WHERE (various joins here...)
AS stuff

CREATE TABLE #id_values
(alt_id CHAR(8) null)

INSERT INTO #id_values
(SELECT DISTINCT id
FROM stuff)

SELECT id, text
FROM stuff a
WHERE EXISTS (SELECT 1 FROM #id_values WHERE b.alt_id = a.id )

If there was a way to format the data better in Excel I would not have to do all this manipulation on the db side.I have tried different formats in the Excel import dialog..import as tab-delimited, space-delimited with the same end result.

Additional information: I converted the TEXT to VARCHAR but I now need a new column which has up to 5 entries per id sometimes. ID -> TYPE is 1-many? The distinct worked on the original list but now I need to figure out how to show all the new column values in one row with each id. The new column is CHAR(4).

Now my original select looks like this:

SELECT DISTINCT id, CONVERT(VARCHAR(8192), text), type_cd
FROM TableA, TableB
...etc

And I get multiple rows again for each type_cd attached to an id. I also realized I don’t think I need the ‘b.’ alias in front of *alt_id*.

Also, regardless of how I format the query (TEXT or VARCHAR), Excel continues to bleed the text into the id rows. Maybe this is not a sql problem but rather with Excel, or maybe Eclipse.

  • 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-08T04:19:18+00:00Added an answer on June 8, 2026 at 4:19 am

    You are limited in how much data you can past into an Excel cell anyway, so convert your text to a varchar:

    SELECT distinct id, cast(text as varchar(255)) as text
    FROM tableA, TableB
    WHERE (various joins here...)
    

    I’m using 255, because that is the default on what Excel shows. You can have longer values in Excel cells, but this may be sufficient for your purposes. If not, just make the value bigger.

    Also, as a comment, you should be using the proper syntax for joins, which uses the “on” clause (or “cross join” in place of a comma).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have using aqua data studio to run my query from sql server 2005.
I am using in C# MYsql .I have query that works if I run
I am trying to query an .xls spreadsheet with VBScript, but I have run
I have the following tables. I want to run a query but I think
I have to run a SQL query using a text value in a label
I have run across an issue in a query using datepart. We have been
I have run a query using COUNT(id) as a way to sum up the
I am needing to run more than one Mysql Query using PHP. I have
I have code to run sql query in ruby as follows sql = ActiveRecord::Base.connection()
I have a .cfc on my server that I use to run a query

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.