Subject: Records not returned with where clause
Posted By: Trojan_uk Post Date: 12/2/2003 1:15:00 PM
Hi,

I am creating a temporary table into which I am passing data from a table so as to page through the results, if I removed the where clause all values are returned but if I add a where clause then no records are returned?

I have run the query in sql and it works fine, I have done a response.write within the asp code so I know the value is being passed into the procedure parameter, the problem is it is as if it is getting lost somewhere during the procedure.

This is the stored procedure:

CREATE TABLE #CILTempItems
(
    myID INT IDENTITY,
    row_id INT,
    NETWORK_ID VARCHAR(3),
    NODE_ID VARCHAR(5),
    CORP_ID VARCHAR(10),
    EMP_ID VARCHAR(10),
    CIL_ID VARCHAR(20),
    CIL_TYPE VARCHAR(1),
    CIL_KEY VARCHAR(10),
    CIL_DESC VARCHAR(20),
    CIL_BILL_FLAG VARCHAR(1),
    RENTAL VARCHAR(1),
    START_DATE datetime,
    END_DATE datetime,
    username VARCHAR(50),
    action_date datetime,
    user_action CHAR(1)
    

)


-- Insert the rows from tblItems into the temp. table


INSERT INTO #CILTempItems (row_id,NETWORK_ID,NODE_ID,CORP_ID,EMP_ID,CIL_ID,CIL_TYPE,CIL_KEY,CIL_DESC,CIL_BILL_FLAG,RENTAL,START_DATE,END_DATE,username,action_date,user_action)

SELECT* FROM Employee_CIL WHERE NETWORK_ID = @NID




and this is the code in the asp page:

strSQL = "dbo.employee_cil_page " & currentPage & "," & iRecordsPerPage & "," & request("nid")  & "," &  request("cid") & "," & request("emp")
objRS.Open strSQL, objConn

As I say it works fine without the where clause so maybe the problem lies in trying to use it on a temp table.

Thanks for any help

Peter


Reply By: Ramanuj Reply Date: 12/3/2003 8:55:22 AM
quote:
Originally posted by Ramanuj

USE correct matches;
TRY "SELECT <<fieldname1, fieldName2> FROM
TABLENAME where <<condition>>"

Reply By: Trojan_uk Reply Date: 12/4/2003 9:03:54 AM
Thanks Ramanuj,

I did in fact work out what i was doing wrong, I was passing the values into the SP as integers not strings that is why it returned no records.

Thabks again
Peter


Go to topic 7199

Return to index page 992
Return to index page 991
Return to index page 990
Return to index page 989
Return to index page 988
Return to index page 987
Return to index page 986
Return to index page 985
Return to index page 984
Return to index page 983