Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 An intresting issue and Urgent response needed

Author  Topic 

shahzeb
Starting Member

6 Posts

Posted - 2008-03-15 : 17:20:38
I am writting a query to retrive some information about a person from the database, now intresting thing is that the query does'nt find the person who dont have a Last name in the database. i pass on the values which user have entered, the values are FirstName, LastName and EmployID, what ever information is given, its passed to the query and the person should be retrived if the person is logged in but problem is that the query works only if the person have a LastName in the database... this is my query.. please tell me what is wrong and what should i change.... its Urgent guys

SELECT distinct top 22 cfg_person.*,cfg_place.name,login_info.callablenumber,login_info_server.server
FROM cfg_person,cfg_login_info,cfg_agent_login,cfg_switch,login_info,cfg_place, login_info_server

where cfg_person.state='1'
and (cfg_switch.type = 5)
and cfg_person.is_agent=2

and cfg_person.first_name like 'Monique%'
and cfg_person.last_name like '%'
and cfg_person.employee_id like '%'


and cfg_person.dbid=cfg_login_info.person_dbid
and cfg_login_info.agent_login_dbid = cfg_agent_login.dbid
and cfg_agent_login.switch_dbid = cfg_switch.dbid
and login_info.person_dbid = cfg_person.dbid
and login_info.logged_voice=1
and cfg_place.dbid = login_info.place_dbid
and login_info.server_id = login_info_server.id

order by cfg_person.first_name

jhocutt
Constraint Violating Yak Guru

385 Posts

Posted - 2008-03-15 : 17:23:12
and IsNull(cfg_person.last_name, '') like '%'


"God does not play dice" -- Albert Einstein
"Not only does God play dice, but he sometimes throws them where they cannot be seen."
-- Stephen Hawking
Go to Top of Page

shahzeb
Starting Member

6 Posts

Posted - 2008-03-15 : 17:39:32
Thanks man, this works now... i will post again if any further complications. I just registered this forum today to get an answer of this question and very much satisfied with the response
Go to Top of Page
   

- Advertisement -