Forum Replies Created

Viewing 15 posts - 91 through 105 (of 107 total)

  • RE: Using Condition in Select

    Can you help me in this...

    Same source table

    ALTER PROCEDURE Emp_Shift1

    (

    @empcode INT,

    @FromDate datetime,

    @EndDate datetime

    )

    AS

    BEGIN

    --DROP TABLE #t

    CREATE TABLE #t(

    [Date] date,

    [Empid]...

  • RE: Insert values into single record

    CREATE TABLE dbo.ShiftScheduler(FromDate DATETIME,Shift INT,ShiftType INT ,Emp_Code VARCHAR(50))

    CREATE TABLE dbo.Emploee(FromDate DATETIME,Shift INT,ShiftType INT ,empid VARCHAR(50))

    INSERT INTO dbo.Emploee values('1/1/2015','1/4/2015',1,1,3321)

    INSERT INTO dbo.Emploee values('1/7/2015 ','1/8/2015 ',1,1,3321)

    INSERT INTO dbo.ShiftScheduler VALUES('1/5/2015','1/6/2015',2,4,3321)

    INSERT INTO dbo.ShiftScheduler VALUES('1/9/2015','1/10/2015',2,4,3321)

  • RE: Insert values into single record

    Hi,

    Almost done with it..please check some bugs still

    ALTER PROCEDURE Emp_Shift1

    (

    @empcode INT,

    @FromDate datetime,

    @EndDate datetime

    )

    AS

    BEGIN

    --DROP TABLE #t

    CREATE TABLE #t(

    [Date] date,

    [Empid]...

  • RE: Using Condition in Select

    Thank you so much it is working has expected...Thanks a lot

  • RE: Using Condition in Select

    ALTER PROCEDURE Emp_Shift1

    @empcode varchar(50),

    @FromDate datetime,

    @EndDate datetime

    AS

    BEGIN

    DECLARE @TotDays INT

    DECLARE @CNT INT

    SET @TotDays = DATEDIFF(DD,@FromDate,@EndDate)-- [NO OF DAYS between two dates]

    ...

  • RE: Using Condition in Select

    If he is shift 1 shifttype 1then the record comes from employee table

    if he is shift 2 shifttype 4 then the record comes from shiftscheduler table

    For example :

    I want...

  • RE: Insert values into single record

    Hi..There are two tables employee and Shiftscheduler which to include where...since yourtable i am not get it exactly

  • RE: Insert values into single record

    USE [process]

    GO

    /****** Object: StoredProcedure [dbo].[Emp_Shift2] Script Date: 05/02/2016 15:01:00 ******/

    SET ANSI_NULLS ON

    GO

    SET QUOTED_IDENTIFIER ON

    GO

    ALTER PROCEDURE [dbo].[Emp_Shift3]

    @FromDate datetime,

    @EndDate datetime

    AS

    BEGIN

    ----CREATE TABLE #Newtemp(ID INT,Emp_Code VARCHAR(50),Shift INT,ShiftType INT,FromDate datetime,EndDate...

  • RE: Insert values into single record

    Find the employee is in which shift and shifttype

    If he is shift 1 shifttype 1then the record comes from employee table

    if he is shift 2 shifttype 4 then the record...

  • RE: Insert values into single record

    USE [process]

    GO

    /****** Object: StoredProcedure [dbo].[Emp_Shift2] Script Date: 05/02/2016 15:01:00 ******/

    SET ANSI_NULLS ON

    GO

    SET QUOTED_IDENTIFIER ON

    GO

    ALTER PROCEDURE [dbo].[Emp_Shift3]

    @FromDate datetime,

    @EndDate datetime

    AS

    BEGIN

    CREATE TABLE #WorkDays(empid1 INT,shift1 INT,shifttype1 INT)

    INSERT INTO #WorkDays(empid1,shift1,shifttype1)

    SELECT...

  • RE: Insert values into single record

    Sample

    Input (Choose it from date to to date)

    Date Empid ...

  • RE: Insert values into single record

    Hi, Thanks for ur reply

    My requirement is like i have two tables one is Shiftscheduler (captures only when Shift and shifttype is 2 and 4 respectively) and another table is...

  • RE: Insert values into single record

    Consider my count is 30

    using while loop i am decrement it..till it reaches zero

    count =30

    then output should be

    Empid empname ...

  • RE: Help me in executing this CASE Statement

    For Achieving the above output i tried like this

    ALTER PROCEDURE Emp_Shift1

    @empcode varchar(50),

    @FromDate datetime,

    @EndDate datetime

    AS

    BEGIN

    DECLARE @TotDays INT

    DECLARE @CNT INT

    SET @TotDays =...

  • RE: Help me in executing this CASE Statement

    Thanks for all your reply...My output concern is from date '2016-04-01','2016-04-24' it has to display all the dates shift type..output sample

    Date ...

Viewing 15 posts - 91 through 105 (of 107 total)