Q:

Keep table data, after SELECT

so i use the following query alot
SELECT [id]
      ,[date]
      ,[pcknum]
      ,[pcktype]
      ,[pckinfo]
      ,[pckuptime]
      ,[pckbyte]
      ,[pcktext]
  FROM [dbo].[RawLog]
  where pcktext like '%USER SC%' and pckinfo = 174 and not (pcktext like '%type=Dial%' or pcktext like '%type=VoicemailCollect%')
  order by date desc

problem is, the table contains more then 10 mio rows, and takes about 20-40 minutes to search trough, and it consumes alot of time.
The table is only accessed by direct user input, as it is used to reverse engineer som network protocols.
i was wondering, if there was a way to make a saved state, of a SQL query, to reduce search times?
for instance a saved state of the query
SELECT [id]
      ,[date]
      ,[pcknum]
      ,[pcktype]
      ,[pckinfo]
      ,[pckuptime]
      ,[pckbyte]
      ,[pcktext]
  FROM [dbo].[RawLog]
  where pcktext like '%USER SC%' and pckinfo = 174

that i could later on, use queries on?
for instance
SELECT [id]
      ,[date]
      ,[pcknum]
      ,[pcktype]
      ,[pckinfo]
      ,[pckuptime]
      ,[pckbyte]
      ,[pcktext]
  FROM table_savedstate_of_RawLog_USERSC
  where not (pcktext like '%type=Dial%' or pcktext like '%type=VoicemailCollect%')
  order by date desc

A:

You can use temp tables for this  
SELECT [id]
      ,[date]
      ,[pcknum]
      ,[pcktype]
      ,[pckinfo]
      ,[pckuptime]
      ,[pckbyte]
      ,[pcktext]
  into #temptable
  FROM [dbo].[RawLog]
  where pcktext like '%USER SC%' and pckinfo = 174 and not (pcktext like '%type=Dial%' and pcktext like '%type=VoicemailCollect%')
  order by date desc

By this you can access the details that are already queried in the #temptable
for example 
Select * from #temptable where id = 1

You can also index your temptable for better searching when using it
CREATE NONCLUSTERED INDEX IDX_ID ON #temptable(id)  

Hope this helps :)  
**EDIT 
To use the temptable based on your query above
SELECT [id]
      ,[date]
      ,[pcknum]
      ,[pcktype]
      ,[pckinfo]
      ,[pckuptime]
      ,[pckbyte]
      ,[pcktext]
  FROM #temptable
  where not (pcktext like '%type=Dial%' or pcktext like '%type=VoicemailCollect%')
  order by date desc

