Re: Compare Character to numberic



On Mon, 31 Oct 2005 09:51:37 -0800, Daniell wrote:

>Hugo,
>Maybe I am doing to conversion wrong or maybe at the wrong place. I am
>attempting to do it on the join command using the cast verb.
>FROM
> SLTEST1.STST1 STST1
> LEFT OUTER JOIN SLTEST1.STST2 STST2
> ON
> STST1.AUTH1 = STST2.AUTH2 AND
> STST1.SLIP1 = CAST( SUBSTRING( STST2.PRN2, 7, 7 ) as numeric )

Hi Daniell,

If there is no bad data in the table, then this should work. With the
data you posted in an earlier message, this should produce no error
(though you wouldn't get any matches on the join condition, as I
explained in my previous message).

If you want me to help you investigate this further, then please do the
following:

1. Copy and paste the output of SELECT @@VERSION in your reply.
2. Also copy and paste the EXACT and COMPLETE text of the error message
you get when running your query from Query Analyzer (if any).
3. Post the complete CREATE TABLE statements for the tables used in the
query. Check www.aspfaq.com/5006 for how you can get the table
definition scripted.
4. Post INSERT statements with some sample data. If the amount of data
in your test database is not prohibitively large, post the complete set
of data (check the link to Vyas' script in www.aspfaq.com/5006).
5. If the query doesn't result in an error but in incorrect output, then
include the expected output from the query as well.

Without the information above, I really can't help you any further than
I've already done.

Best, Hugo
--

(Remove _NO_ and _SPAM_ to get my e-mail address)
.



Relevant Pages

  • Re: Nearest Common Ancestor Report (XDb1s $1000 Challenge)
    ... Hugo Kornelis wrote: ... >>And then for a 10 million record database. ... >>this query would run, please. ... I don't have the money to spare on the kind of hardware that would be ...
    (comp.object)
  • Re: TRICKY SQL
    ... Thanks Hugo and everyone who helped me in solving this issue. ... > Hi Joe, ... > If you had this table, solving your query would be simple. ...
    (microsoft.public.sqlserver.server)
  • Re: TRICKY SQL
    ... Thanks Hugo and everyone who helped me in solving this issue. ... > Hi Joe, ... > If you had this table, solving your query would be simple. ...
    (microsoft.public.sqlserver.programming)
  • Re: sql server issue.
    ... Hugo I found one thing... ... There are three reasons for the performance problem i think... ... When i execute with the sample script which i have send it is getting in ... I am attaching the query i had written. ...
    (microsoft.public.sqlserver.programming)
  • Re: Index View
    ... Start with the execution plan. ... Prabhat wrote: ... >> you can't use this for your query. ... >> Best, Hugo ...
    (microsoft.public.sqlserver.programming)