I've got a report that will fire off a stored procedure on SQL Server. The report takes a couple minutes to run. Currently, in the development environment I'm writing to a couple of temp tables using this type of code:
SELECT *
INTO #Temp1
FROM MyTable
WHERE MyVal = 'X'
SELECT *
INTO #Temp2
FROM MyOtherTable
WHERE MyOtherVal = 'Y'
ETC...
Works fine in a dev environment, but there is a slight possibility that one day two people may kick this off at the same time with two different parameters. If they do, will that cause one #Temp
to be overwritten? If so, what's the best way to handle that? Can you create a #Temp
file name based on a timestamp or something?