I have to create a temp tables…But the problem is if multiple user will use the system there is no way to distinguish between their temporary tables. So I thought of putting an id infront of every table. This will be the unique id.
Any suggestion how to do this?
This unique id is there in my select query :
SELECT TABLE2.ID, TABLE2.NAME, TABLE2.ADDRESS, TABLE2.PHONE, INTO ##TEMP_TABLE
FROM TABLE1 INNER JOIN TABLE2 ON TABLE1.NAME = TABLE2.NAME
GROUP BY TABLE2.ID, TABLE2.NAME, TABLE2.ADDRESS, TABLE2.PHONE;
How can I append this ID with temp table?
Why not just use local temporary tables and not have to worry about it? Just prefix them with a single # mark.