I have the following query which is ok until I put a condition in to run it. The tables are UDF's
SELECT [@DSHEADER].U_PrjCode, [@DSHEADER].U_PrjName, [@DSHEADER].U_InvDate, [@DSHEADER].U_CustNo, [@DSHEADER].U_CardName,
[@DSLINES].U_DocType, [@DSLINES].U_Ref, [@DSLINES].U_StatNo, [@DSLINES].U_Description, [@DSLINES].U_LineTotal
FROM [@DSHEADER] INNER JOIN
[@DSLINES] ON [@DSHEADER].U_StatNo = [@DSLINES].U_StatNo
WHERE [@DSHEADER].U_StatNo =[%0]
If I change the Where to have the actual value i.e U_StatNo='40000' it is ok but if I run it with the [%0] it gives me a SQL Error. I need the condition so that the user can run this query and select the the relevan 'StatNo'
any help would be appreciated