SitePoint Sponsor

User Tag List

Results 1 to 9 of 9

Thread: Insert a field after an existing field

  1. #1
    SitePoint Enthusiast
    Join Date
    Sep 2010
    Posts
    98
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Insert a field after an existing field

    I have already create a Database in c:\path\db1.mdf.

    I also created a Table, table1, and a few Fields: field1, field2, field3, etc.

    In SQL I would like to know how to populate a list of each Field in that Table.

    I also would like to know how to insert a Field after an existing Field previously mentioned.

  2. #2
    SQL Consultant silver trophybronze trophy
    SitePoint Award Recipient r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    38,462
    Mentioned
    35 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by Philosophaie View Post
    In SQL I would like to know how to populate a list of each Field in that Table.
    not sure what you mean by "populate a list of each Field"

    Quote Originally Posted by Philosophaie View Post
    I also would like to know how to insert a Field after an existing Field previously mentioned.
    it's not mysql, so you can't

    good thing is, you don't really need to, since you can always return the columns in whatever sequence you want when you SELECT
    r937.com | rudy.ca | Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  3. #3
    Always A Novice bronze trophy
    K. Wolfe's Avatar
    Join Date
    Nov 2003
    Location
    Columbus, OH
    Posts
    1,863
    Mentioned
    28 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Philosophaie View Post
    I have already create a Database in c:\path\db1.mdf.

    I also created a Table, table1, and a few Fields: field1, field2, field3, etc.

    In SQL I would like to know how to populate a list of each Field in that Table.

    I also would like to know how to insert a Field after an existing Field previously mentioned.
    You'll want to look at this:

    http://stackoverflow.com/questions/4...t-column-names

    and then right hurr:

    http://www.tech-recipes.com/rx/378/a...g-mysql-table/
    <?php
    //Kyle Wolfe
    echo devBlog("My Dev Notes");

  4. #4
    Always A Novice bronze trophy
    K. Wolfe's Avatar
    Join Date
    Nov 2003
    Location
    Columbus, OH
    Posts
    1,863
    Mentioned
    28 Post(s)
    Tagged
    0 Thread(s)
    Woops, just saw this is mssql, syntax may be slightly different, but you can find your way from here, they are both available for SQL server as well
    <?php
    //Kyle Wolfe
    echo devBlog("My Dev Notes");

  5. #5
    SQL Consultant silver trophybronze trophy
    SitePoint Award Recipient r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    38,462
    Mentioned
    35 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by K. Wolfe View Post
    Woops, just saw this is mssql
    maybe it is, maybe it isn't

    on another discussion forum, he's got a thread going in the mysql forum
    r937.com | rudy.ca | Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  6. #6
    Non-Member
    Join Date
    Feb 2013
    Location
    indore
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hello,
    you can read w3school it's good for basic of the database query.

  7. #7
    Always A Novice bronze trophy
    K. Wolfe's Avatar
    Join Date
    Nov 2003
    Location
    Columbus, OH
    Posts
    1,863
    Mentioned
    28 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by amitchoudhary View Post
    hello,
    you can read w3school it's good for basic of the database query.
    No. No. No. Never. w3school should be blocked by ISPs world wide. Bad source
    <?php
    //Kyle Wolfe
    echo devBlog("My Dev Notes");

  8. #8
    Non-Member
    Join Date
    Feb 2013
    Location
    indore
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok.........but i used this so i suggest you.......

  9. #9
    Always A Novice bronze trophy
    K. Wolfe's Avatar
    Join Date
    Nov 2003
    Location
    Columbus, OH
    Posts
    1,863
    Mentioned
    28 Post(s)
    Tagged
    0 Thread(s)
    <?php
    //Kyle Wolfe
    echo devBlog("My Dev Notes");

Bookmarks

Posting Permissions

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