Tags » Aks

how to get last inserted record by username in sql server

emp Table record Like:

empt Table

id  name    date    
1   ankit   18-12-2014 05:55:22.000
2   mehul   18-12-2014 04:44:22.000
3   vimal   18-12-2014 03:44:22.000
4   ankit   18-12-2014 06:00:22.000
5   mehul   18-12-2014 06:10:22.000
… 53 more words
Recent Questions - Stack Overflow

"Only one expression can be specified in the select list when the subquery is not introduced with EXISTS" Error

I am trying to get following query working:

I wrote this Stored Procedure:

IF (@Mode='CurrentRootList') 
BEGIN
SELECT ROW_NUMBER() OVER
  (
        ORDER BY emp1.EmployeeName ASC
  )AS RowNumber 
  ,emp1.empid 
  ,emp1.EmployeeName
  ,(SELECT * FROM  mloc where emp1.MobileID=mloc.MobileID AND mloc.LocationTime = DATEDIFF(MINUTE, mloc.LocationTime , CURRENT_TIMESTAMP)) as LocationTime
  ,emp1.ArrivalTime
  ,emp1.DeviceStatus      
 INTO #CurrentDateRootList
  FROM  emp1 join  root1 ON emp1.EmployeeName = root1.EmployeeName  where (CURRENT_TIMESTAMP BETWEEN root1.StartDate AND root1.EndDate)


  SELECT @RecordCount = COUNT(*)
  FROM #CurrentDateRootList

  SELECT * FROM #CurrentDateRootList
  WHERE RowNumber BETWEEN(@PageIndex -1) * @PageSize + 1 AND(((@PageIndex -1) * @PageSize + 1) + @PageSize) - 1

  DROP TABLE #CurrentDateRootList
END
… 27 more words
Recent Questions - Stack Overflow

How to compare two datetime and find minutes

i want compare two datetime and find minutes in sql

Example :

 1. Date 1= 10/22/2014 20:00:00.000
 2. Date 2= 10/22/2014 23:00:00.000

then i want output like this: 13 more words

Recent Questions - Stack Overflow

Is it possible to update specific rows in Hibernate without touching others?

I am working in a Spring-MVC application using hibernate. In the database, there is one row which contains image of the current object(Product). Now, the user can always update the product Information, but when he is doing that, the information in the database is overwrriten, overriding the image as well. 119 more words

Recent Questions - Stack Overflow

UISlider is not changing its width when I change its frame - ios Swift

I have created one slider using storyboard now I am trying to change its width using this code in viewDidLoad() method :

var parentFrame:CGRect = self.view.frame
var currentFrame:CGRect = timeSlider.frame    // timeSlider is IBOutlet variable
timeSlider.frame = CGRect(x: currentFrame.origin.x + 20, y: currentFrame.origin.y, width:parentFrame.size.width, height: currentFrame.size.height)
… 101 more words
Recent Questions - Stack Overflow

Facebook Syndication Error

This feed URL is no longer valid. Visit this page to find the new URL, if you have access: <a href="http://j.mp/1G0kr3L;