|
|
 |
| 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 p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.
|
 |

September 23rd, 2005, 12:56 PM
|
|
Registered User
|
|
Join Date: Sep 2005
Location: Leicester, , United Kingdom.
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Rename a Column using SQL
I have an Access database and wish to change the name of a table column from within an ASP.NET application.
I would prefer to use an SQL statment and an OleDbCommand to do this and then ExecuteNonQuery() etc.
Two possible SQL statements are:
Code:
ALTER TABLE tablename RENAME COLUMN OldName TO NewName
or
Code:
ALTER TABLE tablename RENAME OldName TO NewName
Neither of these statements work and I get an SQL Syntax Error.
Does anyone know what the correct SQL statment is? I can add and remove columns OK using similar SQL statements, just can't rename a column/field!
Cheers
Graham Wilson
|

September 12th, 2007, 04:34 AM
|
|
Registered User
|
|
Join Date: Jul 2007
Location: , , .
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
EXEC sp_rename
@objname = 'table_name.old_column_name',
@newname = 'new_column_name',
@objtype = 'COLUMN'
|

September 17th, 2009, 01:55 PM
|
|
Registered User
|
|
Join Date: Jan 2007
Location: Wichita, KS, .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
YOUR post is 2 years old. nanny Nanny PooPoo!!
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
 |