Changing the order of columns in a SQL Server Express table


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 13 of 13

Thread: Changing the order of columns in a SQL Server Express table

  1. #1
    Join Date
    Dec 2003
    Posts
    57

    Changing the order of columns in a SQL Server Express table

    In another thread I asked if anyone knew how to change the order of columns in a table in a MS Access database. I am using this (see below) to move the data from MS Access to SQL Server. The columns must be in the sam order but are not. Some users have DB's with columns in the correct order, some do not. Is there any way using program code (VB.Net) to reorder columns in a SQL Server table? This is a distributed app so moving the columns manually is not an option. Thanks!


    cmd.Connection = context.AccessConnection
    cmd.CommandText = "DELETE FROM Account WHERE PolicyTypes = 'S' " & _
    "AND NOT EXISTS (SELECT * FROM Policy WHERE AccountID=Account.AccountID) "
    cmd.ExecuteNonQuery()

  2. #2
    Join Date
    Oct 2005
    Location
    Maady
    Posts
    1,819
    I'm not sure but in Oracle and MySQL you can't so maybe in MS-SQL Too ...
    Programmer&Cracker CS
    MyBlog:Blog.Amahdy.com
    MyWebsite:www.Amahdy.com

  3. #3
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,666
    Well, I've never heard of a way, and Goggle turned up nothing, but that doesn't necessarily mean you can't.
    I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
    Please use [Code]your code goes in here[/Code] tags when posting code.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    Modifications Required For VB6 Apps To Work On Vista

  4. #4
    Join Date
    Oct 2005
    Location
    Maady
    Posts
    1,819
    In MYSQL and ORACLE ... I think I have read such info in their documentations ... MySQL I'm pretty sure it's also mentioned in phpMyAdmin ...
    so why we may need to do such operation ?
    Programmer&Cracker CS
    MyBlog:Blog.Amahdy.com
    MyWebsite:www.Amahdy.com

  5. #5
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,666
    Quote Originally Posted by Amahdy
    so why we may need to do such operation ?
    Read his first post. It will make the migration over to SQL Server easier for him.
    I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
    Please use [Code]your code goes in here[/Code] tags when posting code.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    Modifications Required For VB6 Apps To Work On Vista

  6. #6
    Join Date
    Oct 2005
    Location
    Maady
    Posts
    1,819
    ah okay well I have two ideas maybe they can helps:
    -deal with the access database itself, like making another copy, change colums in it and do all your managments, last replace it with the original one...

    **select col3,col2,col5,col1 ...etc ; instead of select * ... this will return an ordered table as the order of col3 | col2 | ... and so on ...
    Programmer&Cracker CS
    MyBlog:Blog.Amahdy.com
    MyWebsite:www.Amahdy.com

  7. #7
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,666
    Geno, I have a question.

    I know from past posts and threads that you have like 800 migrations to do in offices all over the place.

    All of the products that my company sells uses SQL Server as their backend database. When a new customer purchases one of our products for the first time, we send a database guy to their site that sets up the SQL Server database for them, and loads the initial software on a network file server, and kind of oversees the client side installations.

    Will you be having anyone actually onsite at any of these locations during this migration?
    I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
    Please use [Code]your code goes in here[/Code] tags when posting code.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    Modifications Required For VB6 Apps To Work On Vista

  8. #8
    Join Date
    Dec 2003
    Posts
    57
    No unfortunately we won't have anyone on site to help the users with this. We have a help desk but not enough of them to help each client with this.

  9. #9
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,666
    Ok, but setting a SQL Server, especially for the first time, is no walk in the park. If you aren't going to have any of your people onsite, then these clients HAVE to have someone on site that knows what they are doing in order to install this database software.

    How about this for a suggestion.

    Once the SQL Server software is setup, could you have the sites send you their MDB files, and have you guys migrate it over to their SQL Server for them from your shop?

    This would require you being able to establish a link between your place of business an theirs, of course.
    I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
    Please use [Code]your code goes in here[/Code] tags when posting code.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    Modifications Required For VB6 Apps To Work On Vista

  10. #10
    Join Date
    Dec 2003
    Posts
    57
    I'm not involved in our installation, so I don't know the details. I'm toldit should be seemless. We are actually using SQL Express. At the developer end, where I'm at, I use SQL Server to mess with it so I'm used to calling it that instead. Your suggestion is a good one. I just don't know if our powers that be are willing to devote the manpower for that kind of support. We may find we have to. Thanks for taking the time to reply to my questions!

  11. #11
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,666
    Quote Originally Posted by Geno
    I'm told it should be seemless.
    Geno, my friend, if I have a buck for everytime I've heard that I wouldn't be responding to your threads. I'd be on a beach somewhere sipping drinks with little flowered umbrellas in them.
    Quote Originally Posted by Geno
    I just don't know if our powers that be are willing to devote the manpower for that kind of support. We may find we have to.
    I think you are right.
    I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
    Please use [Code]your code goes in here[/Code] tags when posting code.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    Modifications Required For VB6 Apps To Work On Vista

  12. #12
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,666
    One more parting thought.

    It wasn't in this thread, but one of the other threads you posted you mentioned that you had like 800 of these to do.

    If anyone on this planet thinks that 800 migrations, even backed by a full onsite staff, will be seemless, then they have taken one two many calls from the mother ship.
    I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
    Please use [Code]your code goes in here[/Code] tags when posting code.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    Modifications Required For VB6 Apps To Work On Vista

  13. #13
    Join Date
    Dec 2003
    Posts
    57

Similar Threads

  1. query tuning
    By dhaya in forum Database
    Replies: 11
    Last Post: 08-25-2003, 06:24 PM
  2. Syntax Error Updating SQL Server Table
    By Ralf in forum Database
    Replies: 26
    Last Post: 08-08-2002, 09:58 AM
  3. SQL server vs Access
    By Samantha in forum Database
    Replies: 6
    Last Post: 01-25-2002, 03:15 PM
  4. Changing Server Name
    By Levi Nkata in forum Database
    Replies: 3
    Last Post: 04-11-2001, 10:31 AM
  5. SQL Server Agent wont auto start
    By David Hay in forum Database
    Replies: 2
    Last Post: 04-02-2001, 08:11 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center