Data Length Limit Is Select?

Select of 24 char VARCHAR retrieves more

Page 1 of 1

4 Replies - 2070 Views - Last Post: 02 March 2005 - 07:54 AM Rate Topic: -----

#1 YankeeBastid  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 23-January 05

Data Length Limit Is Select?

Posted 22 February 2005 - 06:07 PM

The table is EVENT, the ID is Event_ID and is a VARCHAR(24) field type. When I select using the following statement I am returned records than I should. Note the values in position 20:
SELECT * FROM EVENT WHERE EVENT_ID = 200502222010100101030100

RETURNS THESE VALUES:
200502222010100101010100
200502222010100101020100
200502222010100101030100

I should only be retrieving the LAST record. Is there a limit to the length of a record ID beyond which all characters are dropped if all others are identical that preceed it?

Is This A Good Question/Topic? 0
  • +

Replies To: Data Length Limit Is Select?

#2 skyhawk133  Icon User is offline

  • Head DIC Head
  • member icon

Reputation: 1876
  • View blog
  • Posts: 20,284
  • Joined: 17-March 01

Re: Data Length Limit Is Select?

Posted 22 February 2005 - 06:13 PM

I might be wrong, but since the fieldtype is varchar, shouldn't you put quotes around the value in the where clause?

Only numbers and dates can go without quotes I believe.
Was This Post Helpful? 0
  • +
  • -

#3 Amadeus  Icon User is offline

  • g+ + -o drink whiskey.cpp
  • member icon

Reputation: 248
  • View blog
  • Posts: 13,507
  • Joined: 12-July 02

Re: Data Length Limit Is Select?

Posted 22 February 2005 - 07:17 PM

You are not wrong...the query is returning all due to the lack of quotes when looking for a string.
Was This Post Helpful? 0
  • +
  • -

#4 born2c0de  Icon User is offline

  • printf("I'm a %XR",195936478);
  • member icon

Reputation: 180
  • View blog
  • Posts: 4,667
  • Joined: 26-November 04

Re: Data Length Limit Is Select?

Posted 02 March 2005 - 05:57 AM

just out of curiosity....what is the maximum amount of characters varchar can take?

And aren't we supposed to use varchar2 instead of varchar? I read someplace that varchar is reserved for later versions and instead we should use varchar2...is this true?
Was This Post Helpful? 0
  • +
  • -

#5 Amadeus  Icon User is offline

  • g+ + -o drink whiskey.cpp
  • member icon

Reputation: 248
  • View blog
  • Posts: 13,507
  • Joined: 12-July 02

Re: Data Length Limit Is Select?

Posted 02 March 2005 - 07:54 AM

Your question depends on the database being used...while similar, there are many differences between db software architectures, including field length. For example, Access (not my reccomendation) does not carry a varchar type in later releases, only text type. MS SQL, however, has an 8000 character limit on it's varchar type.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1