Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2011
    Posts
    47

    Unanswered: why this query throws an error ?

    Code:
    select * from emp_info where emp_id = 66
    gives me blank rows because there is no record for this emp_id
    but when i do something like this
    Code:
    select * from emp_info where emp_id = e3
    why this throws an error ? saying
    Code:
    Msg 207, Level 16, State 1, Line 1
    Invalid column name 'e3'.

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    you forgot the quotes which are needed to delimit a string
    Code:
    select * from emp_info where emp_id = 'e3'
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply 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
  •