Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
H

Hitesh R

@Hitesh R
About
Posts
5
Topics
0
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • SQL Seconds to Day, Hour, Minute, Second
    H Hitesh R

    try this :

    DECLARE @DurationSeconds INT
    DECLARE @DurationDays INT
    SET @DurationSeconds = 62110
    SET @DurationDays = @DurationSeconds /86400

    Select CASE WHEN @DurationDays > 0 THEN
    Convert(VarChar,@DurationDays)+ ':'+
    Convert(VarChar, DateAdd(S, (@DurationSeconds-(@DurationDays*86400)),0), 108)
    ELSE
    Convert(VarChar, DateAdd(S, @DurationSeconds, 0), 108)
    END

    Database database css

  • Continuous absent query
    H Hitesh R

    WITH Dates
    (
    EntryDate,
    EmployeeNumber,
    Status,
    Days,
    EmployeeCode,
    EmployeeName,
    DeptName,
    JobName,
    HOD,
    Supervisor
    )
    AS
    (
    SELECT
    a.[DATE],
    a.EmployeeID,
    a.Status,
    1,a.EmployeeCode,a.EmployeeName,a.DeptName,a.JobName,a.HOD,a.Supervisor
    FROM
    tblEmployeeAttendance1 a

    WHERE
        a.\[Date\] between @StartDate and @EndDate and (a.status='AB' OR a.Status='O') AND datepart(dw,a.\[Date\]) NOT IN (1,7)
    -- RECURSIVE
    UNION ALL
    
    SELECT
        a.\[DATE\],
        a.EmployeeID,
        a.Status,
        CASE WHEN (a.Status = Parent.Status) THEN Parent.Days + 1 ELSE 1 END,
        a.EmployeeCode,a.EmployeeName,a.DeptName,a.JobName,a.HOD,a.Supervisor
    FROM
        tblEmployeeAttendance1 a
    INNER JOIN
        Dates parent
    ON
        datediff(day, a.\[DATE\], DateAdd(day, 1, parent.EntryDate)) = 0
    AND
        a.EmployeeID = parent.EmployeeNumber  where a.\[Date\] between @StartDate and @EndDate and (a.status='AB' OR a.Status='O') AND datepart(dw,a.\[Date\]) NOT IN (1,7)
    

    )
    SELECT * FROM Dates where days>=2 order by EmployeeNumber, EntryDate

    I have added AND datepart(dw,a.[Date]) NOT IN (1,7), which will excludes weekly off days. this would work perfactly.

    Database question database help

  • locking on select
    H Hitesh R

    One reason would be occurance of deadlock while executing the update query. deadlock occurs at that time you are trying to do multiple operation on the same table at the same time. e.g. select and update both operations are done on same table same time then deadlock will occurs. To avoid this situation use no lock in your select query and use update lock in your update query.

    Database help question sharepoint discussion announcement

  • MS SQL didn't allow to store apostrophe( ' ) in name
    H Hitesh R

    to store name like Mohammed's pass Mohammed''s then it will allow to save data.

    Database database help

  • SQL Select Where query
    H Hitesh R

    Try the following query.

    SELECT CASE WHEN COUNT(File_Name)=0 THEN 1 ELSE COUNT(File_Name) END as FileName from tblname
    WHERE (File_Name = @File_Name1)

    Database help database question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups