It appears there is no mssql query to rename a table (yet oracle and mysql both have one), Here is what I have, and I need to write a query to rename a table. It's a bit messy at the moment, but basically I've got a customer table and my user entered the name wrong and added a bunch of data anyway. I want to set it up so she can rename it from the website. It appears there is no option short of creating a new table copying the data and deleting the old table, which seems like a horrible waste of memory. (yes I have to use tables) There is also the companyList database which just contains contact info for each company. I don't need to worry about this one.
Is there any query that would work at all for this?
<%
dim delete, customers, maincontact, phonenumber, altphone, email, fax, catalog
companyName = request.form("companyName"
delete = request.form("delete"
catalog = request.form("catalog"
if delete = "deleteYes" then
Set Rs = Server.CreateObject("ADODB.Recordset"
SQL = "DROP TABLE [" & companyName & "]"
Rs.Open SQL, outsales, 1,3
set RS = nothing
set Rs = Server.CreateObject("ADODB.Recordset"
SQL = "SELECT * from companyList WHERE customers LIKE '"& companyName &"'"
Rs.Open SQL, outsales, 1,3
do while not rs.EOF
if Rs("customers"
= companyName then Rs.Delete
rs.movenext
loop
set rs=nothing
response.redirect "default.asp"
else
customers = request.form("customers"
mainContact = request.form("mainContact"
phoneNumber = request.form("phoneNumber"
altPhone = request.form("altPhone"
email = request.form("email"
fax = request.form("fax"
catalog = request.form("catalog"
set rs=nothing
set Rs = Server.CreateObject("ADODB.Recordset"
SQL="SELECT * FROM companyList WHERE customers LIKE '"& companyName &"'"
Rs.Open SQL, outsales, 1,3
'rs("customers"
= customers
rs("phoneNumber"
= phoneNumber
rs("altPhone"
= altPhone
rs("mainContact"
= mainContact
rs("email"
= email
rs("fax"
= fax
rs("catalog"
= catalog
rs.update
response.redirect "default.asp"
end if
%>
Is there any query that would work at all for this?
<%
dim delete, customers, maincontact, phonenumber, altphone, email, fax, catalog
companyName = request.form("companyName"
delete = request.form("delete"
catalog = request.form("catalog"
if delete = "deleteYes" then
Set Rs = Server.CreateObject("ADODB.Recordset"
SQL = "DROP TABLE [" & companyName & "]"
Rs.Open SQL, outsales, 1,3
set RS = nothing
set Rs = Server.CreateObject("ADODB.Recordset"
SQL = "SELECT * from companyList WHERE customers LIKE '"& companyName &"'"
Rs.Open SQL, outsales, 1,3
do while not rs.EOF
if Rs("customers"
rs.movenext
loop
set rs=nothing
response.redirect "default.asp"
else
customers = request.form("customers"
mainContact = request.form("mainContact"
phoneNumber = request.form("phoneNumber"
altPhone = request.form("altPhone"
email = request.form("email"
fax = request.form("fax"
catalog = request.form("catalog"
set rs=nothing
set Rs = Server.CreateObject("ADODB.Recordset"
SQL="SELECT * FROM companyList WHERE customers LIKE '"& companyName &"'"
Rs.Open SQL, outsales, 1,3
'rs("customers"
rs("phoneNumber"
rs("altPhone"
rs("mainContact"
rs("email"
rs("fax"
rs("catalog"
rs.update
response.redirect "default.asp"
end if
%>