Click here to Skip to main content
16,018,057 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Hi,

I get the following error when I try to use First and Last Function.

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

I read in a blog that min and max functions can be used as replacement. Is there any other alternative?

Thanks in Advance
Posted

Have a look at W3Schools: http://www.w3schools.com/sql/sql_func_first.asp[^] - it provides a workround if the function does not exist
 
Share this answer
 
Comments
Herman<T>.Instance 15-Jan-13 4:02am    
very usefull link, my 5
OriginalGriff 15-Jan-13 4:22am    
W3Schools are a very good source for HTML, SQL and JavaScript reference, among others.
Herman<T>.Instance 15-Jan-13 4:40am    
I currently have a mysql/php project to do (not my expertise) and with the help of w3schools I manage ;)
OriginalGriff 15-Jan-13 4:51am    
:laugh:
Alternatively you can use top 1 in conjuction with order by clause
i.e.
TO get last, use
SQL
Select top 1 column1 from yourtable Order by id Desc


To get first, use
SQL
Select top 1 column1 from yourtable Order by id


Hope that helps, if it does, mark it as answer/upvote.

Thanks
Milind
 
Share this answer
 
Comments
Herman<T>.Instance 15-Jan-13 4:01am    
that's it, My 5

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900