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)
 Code Error

Author  Topic 

sross81
Posting Yak Master

228 Posts

Posted - 2008-07-18 : 11:27:53
Hello,

I have this code:

select a.person_id, a.first_name as patfname,a.last_name as patlname,
a.date_of_birth,b.rx_quanity, b.rx_refills,b.sig_desc,c.create_timestamp,
d.brand_name,d.generic_name,
e.first_name as provfname, e.last_name as provlname, e.other_lic_id,
f.address_line_1,f.city,f.state,f.zip,f.phone,f.fax,
g.description
from person a
join patient_medication b on a.person_id = b.person_id
join patient_encounter c on b.enc_id = c.enc_id
join fdb_medication d on b.ndc_id = d.ndc_id
join provider_mstr e on b.provider_id = e.provider_id
join location_mstr f on b.location_id = f.location_id
join diagnosis_code_mstr g on b.diagnosis_code_id = g.diagnosis_code_lib_id

When I run it I get an error that says
Msg 8169, Level 16, State 2, Line 1
Conversion failed when converting from a character string to uniqueidentifier.

I looked it up and it says it has to due with invalid guids possibly. I was wondering if anyone knows how I can make it so that it does not select and try to use invalid guids? I am not even sure which table it is occuring in either because I am pretty sure they all use guids as unique identifiers. I would appreciate any ideas.

Thank you!
-Sherri

Thanks in Advance!
Sherri

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-07-18 : 11:30:46
which is your guid column involved?
Go to Top of Page

sross81
Posting Yak Master

228 Posts

Posted - 2008-07-18 : 11:38:26
I decided to take it one join at a time and run it until I found the table that was causing the problem. I found it...of course it was the very last table. It had multiple unique indentifer columns apparently I just chose the wrong one cause I think I got it fixed...at least I don't get the error anymore. Thanks for reading my post :).


quote:
Originally posted by visakh16

which is your guid column involved?



Thanks in Advance!
Sherri
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-07-18 : 11:41:17
quote:
Originally posted by sross81

I decided to take it one join at a time and run it until I found the table that was causing the problem. I found it...of course it was the very last table. It had multiple unique indentifer columns apparently I just chose the wrong one cause I think I got it fixed...at least I don't get the error anymore. Thanks for reading my post :).


quote:
Originally posted by visakh16

which is your guid column involved?



Thanks in Advance!
Sherri


cool
glad that you sorted it out
Go to Top of Page
   

- Advertisement -