Skip to content
Advertisement

Tag: sql-server-2008

How to group records by hours considering start date and end date

I’m trying to group records by hours with consideration of duration. Assume there are long running processes and there is log data when process has been started and finished. I’m trying to get report by hours how many processes were running The data looks like this Process_name Start End ‘A’ ‘2019/01/01 14:10’ ‘2019/01/01/ 14:55’ ‘B’ ‘2019/01/01 14:20’ ‘2019/01/01/ 16:30’ ‘C’

Already inserted data replace into another UserId

In my Business unit table FK is the UserId ex: UserId =001, BusinessUnit = Bangalore ex: UserId =001, BusinessUnit = Hyd …. Now, I need UserId = 002 is different I want to create same data into 002 The INSERT statement conflicted with the FOREIGN KEY constraint “FK_UserAccess_UserDetails”. The conflict occurred in database “DataBase Name”, table “dbo.UserDetails”, column ‘UserId’. Answer

Advertisement