Advertisement
Advertisement
| 07.27.2008 at 04:22PM PDT, ID: 23599427 |
|
[x]
Attachment Details
|
||
|
[x]
The Solution Rating System
|
||
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: |
declare @Rows int declare @exam_id int declare @patient_id int declare @image_path varchar(1000) declare @media_type varchar(25) declare @tab table(i int identity, exid int, patid int, impa varchar(1000), medty varchar(25)) /***************************************************/ /** GET NUMBER OF ROWS *****************************/ /***************************************************/ Insert into @Tab SELECT exam_id, pat_id, image_path, [media type] from Exam where pat_id > 0 order by exam_id desc select @Rows = @@ROWCOUNT /*print @Rows*/ /***************************************************/ /** CHECK FOR FILE EXISTENCE ***********************/ /***************************************************/ declare @returnBit bit select @returnBit = 0 /***************************************************/ /* while there are rows: */ /* check if media type is image server */ /* if it is, check the existence of file1 */ /* if it exist, set returnBit as 1 else 0 */ /***************************************************/ while @Rows > 0 Begin create table #a (s varchar(1000)) declare @Path varchar(128) , @FileName varchar(128) select @exam_id = exid, @patient_id = patid, @image_path = impa, @media_type = medty from @tab where i = @Rows /*DEBUG*/ /*print @exam_id*/ /*print @patient_id*/ /*print @image_path*/ /*print @media_type*/ if @media_type = 'Image Server' begin select @Path = 'C:\images\' + replace(@image_path,'/', '\'), @FileName = 'ps.dir' declare @cmd varchar(1000) select @cmd = 'dir /B ' +'"'+ @Path + @FileName+'"' print @cmd insert #a exec master..xp_cmdshell @cmd /*exec master..xp_cmdshell @cmd*/ select @returnBit = CASE when exists (select * from #a where s = @FileName) then 1 else 0 End print @returnBit /***************************************************/ /** SET MEDIA TYPE TO ARCHIVE IF FILE NOT FOUND **/ /***************************************************/ /* if returnBit is 0 (if file1 is not found then) */ /* insert into table @tab2 */ /***************************************************/ declare @tab2 table(i int identity, exam_id int, pat_id int, image_path varchar(1000), media_type varchar(25), fullPath varchar (1000), found bit) if @returnBit = 0 begin insert into @tab2 (exam_id, pat_id, image_path, media_type, fullPath, found) values (@exam_id, @patient_id, @image_path, @media_type, @cmd, @returnBit) /*set [Media Type] = 'Archive'*/ end /*end if returnBit == 0*/ end /*end if media type == image server*/ /* decrement counter */ SET @Rows = @Rows - 1 /* drop temporary table */ drop table #a END /* End while there are still rows to process */ select * from @tab2 |