Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP 3 Classic ASP Active Server Pages 3.0 > Classic ASP Databases
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old January 4th, 2005, 11:16 PM
Authorized User
 
Join Date: Aug 2003
Location: , , India.
Posts: 52
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to rename a table in SQL Server

Hi all,
I searched google and tried all syntaxes to rename a table but none worked.
Can anyone tell me the syntax to rename a table in SQL Server 2000.

I opted to use stored proc 'sp_rename" to rename table in my asp code.
But the thing is it also gives error. Can anyone pls enlighten me whether we can call system stored proc thru ASP.

My code is:

conn.ConnectionString="Provider=SQLOLEDB;Data Source=(local);Database=mydb;UID=sa;PWD=;"
    conn.open

    '************ Rename Table *****************
    oldtable="student_registration"
    newtable="student_registration_old"

    dim cmd
    Set cmd = Server.CreateObject("ADODB.Command")
    Set cmd.ActiveConnection = conn
    cmd.CommandText = "sp_rename"
    cmd.CommandType = adCmdStoredProc 'Line 18

    cmd.Parameters.Append cmd.CreateParameter("@oldtable", adVarchar,adParamInput,30,oldtable)
    cmd.Parameters.Append cmd.CreateParameter("@newtable", adVarchar,adParamInput,30,newtable)
    cmd.Execute()

    '************ End Rename Table *****************

The following error is on line 18:
Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.


Is it due to the fact that the connection string refers to "mydb" database while sp_rename is in "master" database ?


regards

Vinay


Reply With Quote
  #2 (permalink)  
Old January 4th, 2005, 11:48 PM
Friend of Wrox
 
Join Date: Dec 2004
Location: Chennai, Tamil nadu, India.
Posts: 307
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Vadivel Send a message via Yahoo to Vadivel
Default

I too think so .. but not sure as its long since I worked with ASP! Btw check out this http://vadivel.thinkingms.com/Catego...6-b255e22e47c3

Best Regards
Vadivel

MVP ASP/ASP.NET
http://vadivel.thinkingms.com
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Rename a Column using SQL pipelineconsulting Classic ASP Databases 5 September 16th, 2013 10:11 AM
Rename Field using SQL spazband Access 5 May 20th, 2011 06:20 AM
SQL Rename a Field? seananderson BOOK: Beginning SQL 2 May 20th, 2011 06:19 AM
Rename a table through SQL in SQL Server pankaj_daga SQL Server 2000 5 June 27th, 2008 03:31 AM
Rename table collie Access 1 February 23rd, 2005 01:49 PM



All times are GMT -4. The time now is 04:02 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.