#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Posts
    1
    Rep Power
    0

    select 8 from tablename


    select 8 from tablename,if i wrote like this it will replace all the columns as 8.why it happended.what is the drawback in this.
  2. #2
  3. SQL Consultant
    Devshed Supreme Being (6500+ posts)

    Join Date
    Feb 2003
    Location
    Toronto Canada
    Posts
    27,280
    Rep Power
    4279
    first of all, doing this will not "replace" anything, because SELECT statements are read only

    you are allowed to specify a numeric literal in the SELECT list of columns

    so this will return the literal 8 for each row in the table

    make sense?
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

IMN logo majestic logo threadwatch logo seochat tools logo