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

Dan Waters dwaters at usinternet.com
Wed Jun 20 11:22:07 CDT 2007


John,

Could you add a date field to the table with names - where that date field
records when that name was pulled last?  Or if you want to record all the
times a name was pulled then a small subtable might work.  Perhaps?

Dan

-----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 10: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