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
 General SQL Server Forums
 New to SQL Server Programming
 MID - not recognized?

Author  Topic 

tariq2
Posting Yak Master

125 Posts

Posted - 2012-01-03 : 08:48:50

Hi, I am trying to run the following, thank you in advance:

select * from BIProd.dbo.BIRefreshLog where Object = 'ETL' AND
DURATION >'7200' AND MID(StartDateTime,7,2) = '01'

and receive the following:



Msg 195, Level 15, State 10, Line 2
'MID' is not a recognized built-in function name.

sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2012-01-03 : 09:03:16
MID is not a T-SQL function (assuming you are using Microsoft SQL Server). Use SUBSTRING instead. http://msdn.microsoft.com/en-us/library/ms187748.aspx

That is assuming that StartDateTime is of character type. If it is one of the datetime types, use DATEPART function.
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2012-01-03 : 14:04:04
This is M$ Access, right


SELECT *
FROM BIProd.dbo.BIRefreshLog
WHERE Object = 'ETL'
AND DURATION >'7200'
AND SUBSTRING(CONVERT(varchar(10),StartDateTime,102),7,2) = '01'



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx


Want to help yourself?

http://msdn.microsoft.com/en-us/library/ms130214.aspx

http://weblogs.sqlteam.com/brettk/

http://brettkaiser.blogspot.com/


Go to Top of Page
   

- Advertisement -