I want to do the following with a procedure:
I have per user that has the same structure. The only difference is the table name. I need to be able to pass the table name to a procedure and retrieve data for that table. At the moment I have this:
sp_getdata(id, givendate datetime,tablename varchar(200))
BEGIN
SELECT column1, column2, column3
FROM 'tablename', table2
WHERE 'tablename'.id = id
AND
'tablename'.date = givendate;
AND 'tablename'.uniqueid=table2.uniqueid
END;
table2 never change but tablename yes. Any idea how can I do this? thanks
Software/Hardware used:
ASKED:
May 14, 2012 5:55 AM
UPDATED:
May 16, 2012 9:18 AM