1. No Profile Picture
    Registered User
    ASP Explorer (0 - 99 posts)

    Join Date
    Feb 2004
    Rep Power

    Talking Change Tables Field Size ie. varchar(50) to varchar(100) - SQL Server 2000

    I'm pretty deep into a web application I'm building for my current employer. It's about 90% done, 3 weeks of work. Because of this I do not want to change the setup of the project.

    I would ideally like to be able to change the size of fields in a table. Such as, varchar(50) to varchar(100). I'm just wondering if the resizing is possible.

    Another problem I am having is renaming a table. I've seen the syntax for it but everytime I try it doesn't work.

    My code:

    if not form_in_new_name = "" then
    sSQL = "RENAME " & form_in_name & "_table TO " & form_in_new_name & "_table ;"
    Set rs2 = cn.Execute(sSQL)
    Set rs2 = Nothing

    Thanks for the help in advance!
  2. #2
  3. Unholy Moderator
    ASP Mastermind (5000+ posts)

    Join Date
    Oct 2003
    In hell, where did you think?
    Rep Power
    1) Can't you just change the size in Enterprise Manager?
    2) You need to use the alter table command, like this
    If(Len(form_in_new_name) <> 0) then 
       sSQL = "ALTER TABLE '" & form_in_name & "'_table  RENAME TO '" & form_in_new_name & "'_table"
       Set rs2 = cn.Execute(sSQL)
       Set rs2 = Nothing
    End If
    BTW, In the future please post you questions in the proper forum. The Code Bank is for sample code only, not for questions.
    Last edited by Memnoch; February 26th, 2004 at 03:25 PM.

Similar Threads

  1. SQL Server 2000 with MS Access
    By dsutherl@mail.m in forum Microsoft Access Help
    Replies: 10
    Last Post: June 7th, 2005, 01:22 AM
  2. Creating And Altering Tables In Microsoft SQL SERVER 2000
    By ducani in forum Development Articles
    Replies: 4
    Last Post: February 17th, 2005, 12:08 AM
  3. How to change the COMPUTER NAME in SQL Server 2000 manager???
    By Andrew2004 in forum Microsoft SQL Server
    Replies: 6
    Last Post: February 15th, 2004, 11:14 AM
  4. Tutorial On Microsoft SQL Server 2000 And T-SQL
    By ducani in forum Development Articles
    Replies: 2
    Last Post: September 13th, 2003, 09:18 PM
  5. Web serverístatistical analysis
    By cso in forum ASP Development
    Replies: 0
    Last Post: April 19th, 2003, 11:35 AM

IMN logo majestic logo threadwatch logo seochat tools logo