I'm new to SQL so be gentle with me.
We have a system called Microsoft Great Plains, it uses Business Alerts which as SQL Query based. In order to write effective queries I run them in query analyzer and then paste them into MGP. Our vendor has carried out some bespoke work for us which has resulted in an SLA on a form which holds date and time information, unfortunately it is a text UDF. The data is "dd/mm/yyyyhh:mm:ss" you will notice there is no space. I need to be able to change the text to a date/time variable to use DATEDIFF in my query, can anybody help? I have been able to change the string around to add a space etc, but cannot do the last stretch,
Please help
This is my current query and response:
QUERY
select * from SVC00200
where SVC00200.SRVSTAT = '10A'
AND SVC00200.SRVTYPE = 'SVC'
AND date(left(SVC00200.USERDEF2,10) & ' ' & RIGHT SVC00200.USERDEF2,8)) < getdate()
RESPONSE
Server: Msg 195, Level 15, State 10, Line 4
'date' is not a recognized function name.
Stu
We have a system called Microsoft Great Plains, it uses Business Alerts which as SQL Query based. In order to write effective queries I run them in query analyzer and then paste them into MGP. Our vendor has carried out some bespoke work for us which has resulted in an SLA on a form which holds date and time information, unfortunately it is a text UDF. The data is "dd/mm/yyyyhh:mm:ss" you will notice there is no space. I need to be able to change the text to a date/time variable to use DATEDIFF in my query, can anybody help? I have been able to change the string around to add a space etc, but cannot do the last stretch,
Please help
This is my current query and response:
QUERY
select * from SVC00200
where SVC00200.SRVSTAT = '10A'
AND SVC00200.SRVTYPE = 'SVC'
AND date(left(SVC00200.USERDEF2,10) & ' ' & RIGHT SVC00200.USERDEF2,8)) < getdate()
RESPONSE
Server: Msg 195, Level 15, State 10, Line 4
'date' is not a recognized function name.
Stu