dbTalk Databases Forums  

CONVERT

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss CONVERT in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Mary
 
Posts: n/a

Default CONVERT - 08-04-2003 , 02:46 PM






I created a harvest routine but got an error "...The
number of failing rows exceeds the max specified.
Transform copy 'DTSTransofmration_ Conversion error:
Conversion invalid for datatypes on column pair (source
column EbEmpNumber(DBTYPE_WSTR), destination column
EMPLOYEE_NUMBER(DBTYPE_I4).

So I tried including a CONVERT function in my SQL query so
my entire query looked like:
SELECT EBase.EbClock, '999999999' as COMPANY_SYS_ID,
EBase.EbFirstName,
EBase.EbMiddleName, EBase.EbLastName, EJob.EjTitle,
CONVERT(int, EBase.EbEmpNumber)

FROM EEmploy, EBase, EJob
WHERE EEmploy.EeFlxIDEb = EBase.EbFlxID AND
EBase.EbFlxID = EJob.EjFlxIDEb AND
(EEmploy.EeStatus = 'active') AND
(EEmploy.EeDateEnd IS NULL) AND (EJob.EjDateEnd IS
NULL)
ORDER BY EBase.EbLastName

When I try to preview the query I get the
error: "undefined function 'CONVERT' in the query. I
have tried using CAST also and have checked and rechecked
my syntax.

Any ideas would be much appreciated. Thank you.

Mary

Reply With Quote
  #2  
Old   
Nate Russell
 
Posts: n/a

Default CONVERT - 08-04-2003 , 05:36 PM






In your source select statement, try doing a "CAST
(EbEmpNumber as INT) as EbEmpNumber, <next field>".

You may want to consider LTRIM(RTRIM(EbEmpNumber)) as
well if the source string ever has leading or trailing
spaces. There is also an ISNUMERIC, function that could
be thrown into a CASE statement in case you ever get non-
numeric characters in the data for that column.

Quote:
-----Original Message-----
I created a harvest routine but got an error "...The
number of failing rows exceeds the max specified.
Transform copy 'DTSTransofmration_ Conversion error:
Conversion invalid for datatypes on column pair (source
column EbEmpNumber(DBTYPE_WSTR), destination column
EMPLOYEE_NUMBER(DBTYPE_I4).

So I tried including a CONVERT function in my SQL query
so
my entire query looked like:
SELECT EBase.EbClock, '999999999' as COMPANY_SYS_ID,
EBase.EbFirstName,
EBase.EbMiddleName, EBase.EbLastName, EJob.EjTitle,
CONVERT(int, EBase.EbEmpNumber)

FROM EEmploy, EBase, EJob
WHERE EEmploy.EeFlxIDEb = EBase.EbFlxID AND
EBase.EbFlxID = EJob.EjFlxIDEb AND
(EEmploy.EeStatus = 'active') AND
(EEmploy.EeDateEnd IS NULL) AND (EJob.EjDateEnd IS
NULL)
ORDER BY EBase.EbLastName

When I try to preview the query I get the
error: "undefined function 'CONVERT' in the query. I
have tried using CAST also and have checked and
rechecked
my syntax.

Any ideas would be much appreciated. Thank you.

Mary
.


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.