Results 1 to 2 of 2

Thread: Insert SQL

  1. #1

    Thread Starter
    Member
    Join Date
    Jun 2007
    Posts
    37

    Insert SQL

    hi all,

    i have an insert problem

    for e.g if i haf a table in this form

    A|b|C|D

    i would like to insert a new column field in betweeen b and C

    and my new table will look like

    A|b|c|e|d

    is that possible?

    are there any reference in this area? pls advise me thnx!

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Insert SQL

    This has nothing to do with VB.NET. Questions relating to changing the schema of a database belong in the Database Development forum.

    To alter the schema of a table you execute an ALTER TABLE statement. Just like any SQL statement this can be done by calling the ExecuteNonQuery method of a Command object, but that's as far as VB's involvement goes. You should consult an SQL reference to get the appropriate syntax. There's a standard but each database may vary that a little. Microsoft provide documentation for SQL Server and Access SQL and other database vendors will also provide a full SQL reference for their own flavour.

    I'm not sure whether you can actually insert the new column between existing columns or not but it makes no real difference anyway. You can write your queries to return any combination of columns in any order you want no matter what order they are in in the database itself.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width