Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Andrzejek on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL Query - Within Excel

Status
Not open for further replies.

lbarron

Technical User
Jan 22, 2002
92
GB
Dear All,

I have the following query which uses a date parameter within Excel to filter the data.

When run within Excel I get a error saying "String Data, Right truncation".

The problem appears to be the nested select statement, if I remove this part of the query it works fine.

Any ideas?

the query is as follows (no laughing I'm self taught!) : -

SELECT JOBOPER.JOBNUM, JOBOPER.OPCODE, JOBOPER.ESTPRODHOURS, JOBOPER.PRODLABRATE, (JOBOPER.ESTPRODHOURS*JOBOPER.PRODLABRATE)+JOBOPER.ESTUNITCOST, JOBOPER.ACTLABCOST, JOBOPER.OPCOMPLETE, JOBHEAD.PRODCODE,(SELECT TOP(1) EMPLOYEENUM FROM LABORDTL WHERE JOBNUM = LABORDTL.JOBNUM AND JOBOPER.OPCODE = LABORDTL.OPCODE AND NOT EMPLOYEENUM = 'DUMMY' ORDER BY LABORDTLSEQ DESC)
FROM JOBOPER, JOBHEAD
WHERE (JOBHEAD.CLOSEDDATE=?) AND
(JOBHEAD.JOBNUM=JOBOPER.JOBNUM) AND
(JOBHEAD.COMPANY='SF03') AND
(JOBHEAD.JOBNUM LIKE '5%') AND
SUBCONTRACT = 0

Thanks

Lee
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top