Home All Groups Group Topic Archive Search About

Data is there BUT could NOT find it!

Author
29 Jun 2006 10:05 PM
Seequell
Here is the situvation. I can get BO_ID Field Value based on ROW_ID but I
could not get the same record if I give the BO_ID Value. Please hava a look
at the following query and other details.

Can someone explain why and how it happens? Is it due to QUOTED_IDENTIFIER
ON/OFF Setting. Let me know should you need more info. Thanks.

USE ZADMIN

---BO_ID is there.
SELECT BO_ID, ROW_ID FROM ZADMIN..CB_INST_IMPORT WHERE ROW_ID = 576

   --BO_ID                                                ROW_ID
   --898509508329674401118020031483   576

   --Column_name       Type
   --BO_ID                       varchar
   --ROW_ID       int

---But, could NOT find it if BO_ID is given.
SELECT * FROM ZADMIN..CB_INST_IMPORT
WHERE BO_ID = '898509508329674401118020031483'

SELECT * FROM ZADMIN..CB_INST_IMPORT
WHERE RTRIM(LTRIM(BO_ID)) = '898509508329674401118020031483'

---Length of BO_ID is 30 but query says as 32.
SELECT LEN(BO_ID) FROM ZADMIN..CB_INST_IMPORT
WHERE ROW_ID = 576     --32

--Seequell

Author
29 Jun 2006 11:02 PM
Roy Harvey
I'm curious about those two phantom characters.  Try running something
like:

SELECT *,
       ASCII(SUBSTRING(BO_ID),01,1)),
       ASCII(SUBSTRING(BO_ID),02,1)),
       ASCII(SUBSTRING(BO_ID),03,1)),
       ASCII(SUBSTRING(BO_ID),04,1)),
       ASCII(SUBSTRING(BO_ID),05,1)),
.....
       ASCII(SUBSTRING(BO_ID),29,1)),
       ASCII(SUBSTRING(BO_ID),30,1)),
       ASCII(SUBSTRING(BO_ID),31,1)),
       ASCII(SUBSTRING(BO_ID),32,1))
FROM ZADMIN..CB_INST_IMPORT
WHERE ROW_ID = 576

Roy Harvey
Beacon Falls, CT

On Thu, 29 Jun 2006 15:05:01 -0700, Seequell
<Seequ***@discussions.microsoft.com> wrote:

Show quote
>Here is the situvation. I can get BO_ID Field Value based on ROW_ID but I
>could not get the same record if I give the BO_ID Value. Please hava a look
>at the following query and other details.
>
>Can someone explain why and how it happens? Is it due to QUOTED_IDENTIFIER
>ON/OFF Setting. Let me know should you need more info. Thanks.
>
>USE ZADMIN
>
>---BO_ID is there.
>SELECT BO_ID, ROW_ID FROM ZADMIN..CB_INST_IMPORT WHERE ROW_ID = 576
>
>   --BO_ID                                                ROW_ID
>   --898509508329674401118020031483   576
>
>   --Column_name       Type
>   --BO_ID                       varchar
>   --ROW_ID       int
>
>---But, could NOT find it if BO_ID is given.
>SELECT * FROM ZADMIN..CB_INST_IMPORT
>WHERE BO_ID = '898509508329674401118020031483'
>
>SELECT * FROM ZADMIN..CB_INST_IMPORT
>WHERE RTRIM(LTRIM(BO_ID)) = '898509508329674401118020031483'
>
>---Length of BO_ID is 30 but query says as 32.
>SELECT LEN(BO_ID) FROM ZADMIN..CB_INST_IMPORT
>WHERE ROW_ID = 576     --32
>
>--Seequell
Author
30 Jun 2006 4:22 PM
Seequell
Hi Roy,

I will test it soon and post the result. Thanks for replying.
--
--Seequell


Show quote
"Roy Harvey" wrote:

> I'm curious about those two phantom characters.  Try running something
> like:
>
> SELECT *,
>        ASCII(SUBSTRING(BO_ID),01,1)),
>        ASCII(SUBSTRING(BO_ID),02,1)),
>        ASCII(SUBSTRING(BO_ID),03,1)),
>        ASCII(SUBSTRING(BO_ID),04,1)),
>        ASCII(SUBSTRING(BO_ID),05,1)),
> .....
>        ASCII(SUBSTRING(BO_ID),29,1)),
>        ASCII(SUBSTRING(BO_ID),30,1)),
>        ASCII(SUBSTRING(BO_ID),31,1)),
>        ASCII(SUBSTRING(BO_ID),32,1))
> FROM ZADMIN..CB_INST_IMPORT
> WHERE ROW_ID = 576
>
> Roy Harvey
> Beacon Falls, CT
>
> On Thu, 29 Jun 2006 15:05:01 -0700, Seequell
> <Seequ***@discussions.microsoft.com> wrote:
>
> >Here is the situvation. I can get BO_ID Field Value based on ROW_ID but I
> >could not get the same record if I give the BO_ID Value. Please hava a look
> >at the following query and other details.
> >
> >Can someone explain why and how it happens? Is it due to QUOTED_IDENTIFIER
> >ON/OFF Setting. Let me know should you need more info. Thanks.
> >
> >USE ZADMIN
> >
> >---BO_ID is there.
> >SELECT BO_ID, ROW_ID FROM ZADMIN..CB_INST_IMPORT WHERE ROW_ID = 576
> >
> >   --BO_ID                                                ROW_ID
> >   --898509508329674401118020031483   576
> >
> >   --Column_name       Type
> >   --BO_ID                       varchar
> >   --ROW_ID       int
> >
> >---But, could NOT find it if BO_ID is given.
> >SELECT * FROM ZADMIN..CB_INST_IMPORT
> >WHERE BO_ID = '898509508329674401118020031483'
> >
> >SELECT * FROM ZADMIN..CB_INST_IMPORT
> >WHERE RTRIM(LTRIM(BO_ID)) = '898509508329674401118020031483'
> >
> >---Length of BO_ID is 30 but query says as 32.
> >SELECT LEN(BO_ID) FROM ZADMIN..CB_INST_IMPORT
> >WHERE ROW_ID = 576     --32
> >
> >--Seequell
>
Author
30 Jun 2006 5:02 PM
Seequell
Found it. Hope I am right.
Characters were Line feed (char(10)) and Carriage return (char(13)).
Have a look at the query and result. Now, how do I remove it?
Thanks a lot.

SELECT BO_ID FROM ZADMIN..CB_INST_IMPORT WHERE ROW_ID = 576

BO_ID
--------------------------------------------------
898509508329674401118020031483

---***---

SELECT ASCII(SUBSTRING(BO_ID,01,1)),
      ASCII(SUBSTRING(BO_ID,02,1)),
      ASCII(SUBSTRING(BO_ID,03,1))
   FROM ZADMIN..CB_INST_IMPORT WHERE ROW_ID = 576


----------- ----------- -----------
56          57          56

---***---

SELECT ASCII(SUBSTRING(BO_ID,29,1)),
      ASCII(SUBSTRING(BO_ID,30,1)),
      ASCII(SUBSTRING(BO_ID,31,1)),
      ASCII(SUBSTRING(BO_ID,32,1))
   FROM ZADMIN..CB_INST_IMPORT WHERE ROW_ID = 576   

----------- ----------- ----------- -----------
56          51          13          10

---***---

--
--Seequell


Show quote
"Seequell" wrote:

> Hi Roy,
>
> I will test it soon and post the result. Thanks for replying.
> --
> --Seequell
>
>
> "Roy Harvey" wrote:
>
> > I'm curious about those two phantom characters.  Try running something
> > like:
> >
> > SELECT *,
> >        ASCII(SUBSTRING(BO_ID),01,1)),
> >        ASCII(SUBSTRING(BO_ID),02,1)),
> >        ASCII(SUBSTRING(BO_ID),03,1)),
> >        ASCII(SUBSTRING(BO_ID),04,1)),
> >        ASCII(SUBSTRING(BO_ID),05,1)),
> > .....
> >        ASCII(SUBSTRING(BO_ID),29,1)),
> >        ASCII(SUBSTRING(BO_ID),30,1)),
> >        ASCII(SUBSTRING(BO_ID),31,1)),
> >        ASCII(SUBSTRING(BO_ID),32,1))
> > FROM ZADMIN..CB_INST_IMPORT
> > WHERE ROW_ID = 576
> >
> > Roy Harvey
> > Beacon Falls, CT
> >
> > On Thu, 29 Jun 2006 15:05:01 -0700, Seequell
> > <Seequ***@discussions.microsoft.com> wrote:
> >
> > >Here is the situvation. I can get BO_ID Field Value based on ROW_ID but I
> > >could not get the same record if I give the BO_ID Value. Please hava a look
> > >at the following query and other details.
> > >
> > >Can someone explain why and how it happens? Is it due to QUOTED_IDENTIFIER
> > >ON/OFF Setting. Let me know should you need more info. Thanks.
> > >
> > >USE ZADMIN
> > >
> > >---BO_ID is there.
> > >SELECT BO_ID, ROW_ID FROM ZADMIN..CB_INST_IMPORT WHERE ROW_ID = 576
> > >
> > >   --BO_ID                                                ROW_ID
> > >   --898509508329674401118020031483   576
> > >
> > >   --Column_name       Type
> > >   --BO_ID                       varchar
> > >   --ROW_ID       int
> > >
> > >---But, could NOT find it if BO_ID is given.
> > >SELECT * FROM ZADMIN..CB_INST_IMPORT
> > >WHERE BO_ID = '898509508329674401118020031483'
> > >
> > >SELECT * FROM ZADMIN..CB_INST_IMPORT
> > >WHERE RTRIM(LTRIM(BO_ID)) = '898509508329674401118020031483'
> > >
> > >---Length of BO_ID is 30 but query says as 32.
> > >SELECT LEN(BO_ID) FROM ZADMIN..CB_INST_IMPORT
> > >WHERE ROW_ID = 576     --32
> > >
> > >--Seequell
> >
Author
30 Jun 2006 7:28 PM
Tracy McKibben
Seequell wrote:
Show quote
> Found it. Hope I am right.
> Characters were Line feed (char(10)) and Carriage return (char(13)).
> Have a look at the query and result. Now, how do I remove it?
> Thanks a lot.
>
> SELECT BO_ID FROM ZADMIN..CB_INST_IMPORT WHERE ROW_ID = 576
>
> BO_ID
> --------------------------------------------------
> 898509508329674401118020031483
>
> ---***---
>
> SELECT ASCII(SUBSTRING(BO_ID,01,1)),
>       ASCII(SUBSTRING(BO_ID,02,1)),
>       ASCII(SUBSTRING(BO_ID,03,1))
>    FROM ZADMIN..CB_INST_IMPORT WHERE ROW_ID = 576
>
>               
> ----------- ----------- -----------
> 56          57          56
>
> ---***---
>
> SELECT ASCII(SUBSTRING(BO_ID,29,1)),
>       ASCII(SUBSTRING(BO_ID,30,1)),
>       ASCII(SUBSTRING(BO_ID,31,1)),
>       ASCII(SUBSTRING(BO_ID,32,1))
>    FROM ZADMIN..CB_INST_IMPORT WHERE ROW_ID = 576   
>                                  
> ----------- ----------- ----------- -----------
> 56          51          13          10
>
> ---***---
>

UPDATE CB_INST_IMPORT
SET BO_ID = REPLACE(BO_ID, CHAR(13)+CHAR(10), '')
WHERE ROW_ID = 576
Author
3 Jul 2006 2:08 PM
Seequell
I did it and it worked. Thanks Tracy. I appreciate your help.
--
--Seequell


Show quote
"Tracy McKibben" wrote:

> Seequell wrote:
> > Found it. Hope I am right.
> > Characters were Line feed (char(10)) and Carriage return (char(13)).
> > Have a look at the query and result. Now, how do I remove it?
> > Thanks a lot.
> >
> > SELECT BO_ID FROM ZADMIN..CB_INST_IMPORT WHERE ROW_ID = 576
> >
> > BO_ID
> > --------------------------------------------------
> > 898509508329674401118020031483
> >
> > ---***---
> >
> > SELECT ASCII(SUBSTRING(BO_ID,01,1)),
> >       ASCII(SUBSTRING(BO_ID,02,1)),
> >       ASCII(SUBSTRING(BO_ID,03,1))
> >    FROM ZADMIN..CB_INST_IMPORT WHERE ROW_ID = 576
> >
> >               
> > ----------- ----------- -----------
> > 56          57          56
> >
> > ---***---
> >
> > SELECT ASCII(SUBSTRING(BO_ID,29,1)),
> >       ASCII(SUBSTRING(BO_ID,30,1)),
> >       ASCII(SUBSTRING(BO_ID,31,1)),
> >       ASCII(SUBSTRING(BO_ID,32,1))
> >    FROM ZADMIN..CB_INST_IMPORT WHERE ROW_ID = 576   
> >                                  
> > ----------- ----------- ----------- -----------
> > 56          51          13          10
> >
> > ---***---
> >
>
> UPDATE CB_INST_IMPORT
> SET BO_ID = REPLACE(BO_ID, CHAR(13)+CHAR(10), '')
> WHERE ROW_ID = 576
>

AddThis Social Bookmark Button