Go Back   Computer Forums > General Computing > Software and Operating Systems
Click Here to Login
Join Computer forums Today


Reply
 
Thread Tools Search this Thread Display Modes
 
Old 10-18-2011, 09:37 AM   #1
Fully Optimized
 
ssc456's Avatar
 
Join Date: Jan 2007
Posts: 4,279
Send a message via MSN to ssc456
Default Any SQL Geniuses On Here?

Hey Guys,

Hitting a bit of a wall at the moment with a stored procedure i'm trying to make on my SQL server.
I'm trying to be a bit "cleverer" than i am here but hoping someone can help.

I've got the bit of my select statemernt below which is causing me issues and i'm hopeing someone can tell me what i'm doing wrong.

The message i get when trying to run this as a select statement is
"Conversion failed when converting datetime from character string."

Code:
SELECT     F_TASKS.TA_TASK_ID, F_RESOURCE.RES_NAME, FLOCATE.BG_SITE, FINFILE.IN_DESCRIPTION, F_TASKS.TA_CATEGORY, 
                      F_TASKS.TA_PRIORITY, F_TASK_TIME.TT_ID, F_TASK_TIME.TT_NAME, FINFILE.IN_DEC_HOURS,
    
  'Next_SLA' = CASE

	WHEN (SELECT COUNT (*) FROM F_TASK_TIME WHERE TT_FKEY_TA_SEQ = F_TASKS.TA_SEQ 
and TT_FINISHED Is Not null ) >0 Then 'All SLAs Complete'

	WHEN (SELECT COUNT (*) FROM F_TASK_TIME WHERE TT_FKEY_TA_SEQ = F_TASKS.TA_SEQ 
and TT_CONTAINED Is Not null ) >0 Then 'Permanent Fix'

	WHEN (SELECT COUNT (*) FROM F_TASK_TIME WHERE TT_FKEY_TA_SEQ = F_TASKS.TA_SEQ 
and TT_STARTED Is Not null) >0  and F_TASKs.TA_PRIORITY = 'Priority 3' Then 'Permanent Fix'

	WHEN (SELECT COUNT (*) FROM F_TASK_TIME WHERE TT_FKEY_TA_SEQ = F_TASKS.TA_SEQ 
and TT_STARTED Is Not null) >0  and F_TASKs.TA_PRIORITY <> 'Priority 3' Then 'Temporary Fix'

         ELSE 'Investigate'
      END,

  'Next Date' = CASE

	WHEN 'Next_SLA' = 'Permanent Fix' Then (SELECT TOP 1 TaskPerfSLAFixDate From SLA_TASK_PERFORMANCE
						WHERE TASKPERF_TA_SEQ = F_TASKS.TA_SEQ)

         ELSE 'TEST'
      END
__________________
He who has never failed has never attempted anything worth succeeding at.

Dont Eat Animals, Its Not Good For Them And They Dont Like It!
ssc456 is offline   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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
need help with java an meta search engines meadam Web Programming 20 02-17-2004 12:29 PM


All times are GMT -5. The time now is 11:31 AM.


Powered by vBulletin® Version 3.8.8 Beta 4
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO 3.6.0