If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Microsoft SQL Server > why this query throws an error ?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-04-11, 01:15
navedjobs navedjobs is offline
Registered User
 
Join Date: Sep 2011
Posts: 35
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'.
Reply With Quote
  #2 (permalink)  
Old 12-04-11, 04:18
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,525
you forgot the quotes which are needed to delimit a string
Code:
select * from emp_info where emp_id = 'e3'
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On