Having a stored procedure copy tables & also preserve indexing/sch



Hello,

I created a stored procedure that renames a table to OLD_xxxxx and replaces
that table with another (copy) that resides on a different database. I pull
the
tablename names through the use of a cursor table and construct a SELECT INTO
statement as follows

'SELECT * INTO DB1.dbo.' + @tableName + ' FROM DB2.dbo.' + @tableName

It works great especially since there are 80+ tables that need to be copied
from one database to another. The drawback is that it doesn't preserve the
indexing/foriegn key constraints. Is there a way to do this without having to
deal with DTS or creating additional scripts?? Ideally I would like to
replace
the "SELECT * INTO" statement with something that not only does a copy but
also preserves the indexing! Does such a command exist???? Any help from the
Microsoft guru's would be greatly appreciated!!!!


.



Relevant Pages

  • Re: Database Connection Problem. Please Help
    ... I have a process which first pulls one time all application IDs from a database and stores them in a table. ... The problem is that after processing about 100 records, using SqlDataReader, my database connection will starts failing. ... I've been trying to find a way to pull all details for all records at once, instead of one at a time but I have not been able to do that. ...
    (microsoft.public.dotnet.languages.vb)
  • Database Connection Problem. Please Help
    ... database and stores them in a table. ... The problem is that after processing about 100 records, using SqlDataReader, ... my database connection will starts failing. ... I've been trying to find a way to pull ...
    (microsoft.public.dotnet.languages.vb)
  • Re: updating database views via tableadapter?
    ... "Darren Sim" wrote in message ... One final question - if writing my own update etc commands do I need to pull the respective tables key values through in order to do this? ... > Or create a view in the database and use that created view as a> table. ... >> public void saveReview(ref DataSet review) ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: individual numbering in a inventory database
    ... I would pull from the serialized table and I would make them pull the ... I have an inventory database that I am working on for a small ... maintenance facility. ... have no good way of assigning an individual number to a part. ...
    (microsoft.public.access.gettingstarted)
  • Re: Need Input on Database Design
    ... MS Access MVP ... has a small sample database of this at ... information can be accessed utilizing 4 pull down menus. ... a selection of statistical data for the car model, ...
    (microsoft.public.access.tablesdbdesign)