[thelist] SQL/ASP Rename or Copy Table?
rudy
Rudy_Limeback at maritimelife.ca
Tue Oct 10 16:46:21 CDT 2000
> Is there a way to use SQL from an ASP script to either
> Rename a table or Copy it (structure and data) to another
> table with a different name?
hi tab
depends on the database
since you're using ASP, i'll bet it's either sql/server or msaccess
if it's sql/server, you can use the stored procedure sp_rename
sp_rename oldtablename, newtablename
of course, you have to know how to call a stored proc from your script
(sorry, i don't know ASP)
and i don't know how to rename a table in msaccess, probably some vbscript
command...
but now the good news
in sql/server, you can say
select *
into newtable
from oldtable
and the nice part about the INTO syntax is that you can be selective about
which columns and even which rows you copy over
select foo, bar
into activerows
from historytable
where active=1
you can also use the INTO syntax in msaccess
rudy
r937.com
More information about the thelist
mailing list