[dba-SQLServer] Building a permanent result table on-the-fly

Eric Barro ebarro at verizon.net
Wed Jun 20 10:50:53 CDT 2007


Why not just flag the records with a datestamp and add that in the criteria
so that it only displays records that have not been pulled from the previous
query? 

-----Original Message-----
From: dba-sqlserver-bounces at databaseadvisors.com
[mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of jwcolby
Sent: Wednesday, June 20, 2007 8:46 AM
To: dba-sqlserver at databaseadvisors.com
Subject: [dba-SQLServer] Building a permanent result table on-the-fly

When a client asks me to fill an order of names from a name table I end up
with a view that looks something like:

SELECT     TOP (3000) [FName], [LName], [Addr], [City], [ST], [Zip5],
[Zip4], [Zip]
FROM         dbo.tblData
ORDER BY NEWID()

This in fact pulls an apparently random set of names which is good, we like
that.  The problem is that I need to record those names because the client
may come back in a month and say "now give me a DIFFERENT set of names".
Thus I need to know who was pulled last time.  What I need is a way to take
any result set and build a permanent table to hold the results in.  I also
need a way to build a m-m with the PKID of the pulled set and an OrderPK
from an order table (which I am building), but I already know how to do
that.

John W. Colby
Colby Consulting
www.ColbyConsulting.com 

_______________________________________________
dba-SQLServer mailing list
dba-SQLServer at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/dba-sqlserver
http://www.databaseadvisors.com


 




More information about the dba-SQLServer mailing list