Forum Replies Created

Viewing 14 posts - 1 through 14 (of 14 total)

  • RE: Problem with a Query. Need help

    Thanks Craig. It will take some time to understand the cursor part. I haven't worked on cursors too much, in fact negligible.

  • RE: Problem with a Query. Need help

    Yes Craig.. These Schedules are dynamic and can vary in future

  • RE: Problem with a Query. Need help

    Here are the scripts...

    IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ScheduleTest]') AND type in (N'U'))

    BEGIN

    CREATE TABLE [dbo].[ScheduleTest](

    [StationName] [nvarchar](255) NULL,

    [ScheduleNumber] [nvarchar](255) NULL,

    [ArrivalTime] [nvarchar](20) NULL,

    [DepartureTime] [nvarchar](20) NULL

    ) ON [PRIMARY]

    END

    GO

    --Insert...

  • RE: Problem with a Query. Need help

    Thanks Craig.

    I will build a script tomorrow and will post it again.

  • RE: Index on Date Time Column Not Getting Used

    Sorry for not tracking this on weekends.!

    Thanks to all for putting views but I think I am still far from an answer.

    In order to get an INDEX SEEK you frequently...

  • RE: Index on Date Time Column Not Getting Used

    It's from 1st May to 2nd May.

    and even if I add some more columns and include it in my Select list, Sql Server still goes for Table Scan

  • RE: Do I need a cursor?

    I had a similar requirement. I handled it through a Stored Procedure.. and was calliing the same from a .Net application.

    May be this can help you. I hope I...

  • RE: Error: Invalid object name '##Report'. (Microsoft SQL Server, Error: 208)

    hi here below is query

    set ANSI_NULLS ON

    set QUOTED_IDENTIFIER ON

    go

    ALTER PROCEDURE [dbo].[usp_Test_Reports]

    @intYear int

    as

    Declare @intIncidentCategoryID int;

    Declare @chvIncidentCategory varchar(50);

    Declare @intIncidentModeID int;

    Declare @chvIncidentMode varchar(50);

    Declare @chvCTIncCat nvarchar(4000)

    Declare @chvCTIncMode nvarchar(4000)

    Declare @chvCreateTable nvarchar(4000)

    Declare @chvTableName nvarchar(10);

    Declare...

  • RE: Show Months in table

    hi Ramesh,

    i did changes according u

    but still showing me same error

    here is below the changes i did in my query

    set ANSI_NULLS ON

    set QUOTED_IDENTIFIER ON

    CREATE PROCEDURE [HSI].[usp_MonthlyEPCHazardousSpillReport_2]

    (

    @month int,

    @year...

  • RE: Show Months in table

    hi Ramesh,

    i did changes according u

    but still showing me same error

    here is below the changes i did in my query

    set ANSI_NULLS ON

    set QUOTED_IDENTIFIER ON

    CREATE PROCEDURE [HSI].[usp_MonthlyEPCHazardousSpillReport_2]

    (

    @month int,

    @year...

  • RE: Show Months in table

    hi ramesh ,

    here below is SP which is am try to create

    set ANSI_NULLS ON

    set QUOTED_IDENTIFIER ON

    CREATE PROCEDURE [HSI].[usp_MonthlyEPCHazardousSpillReport_2]

    @month int,

    @year int

    WITH Months

    AS

    (

    SELECT 'January' AS [Month] UNION...

  • RE: Show Months in table

    HI ramesh,

    this Query i try to put in Stored Procedure , but give mr following error

    Msg 195, Level 15, State 1, Procedure usp_MonthlyEPCHazardousSpillReport_2, Line 27

    'Months' is not a recognized option.

    Msg...

  • RE: Show Months in table

    HI ramesh ,

    Really thanks , it working fine now!

    🙂

    Thanks

    kunal

  • RE: Show Months in table

    Hi thanks for reply,

    here below is my query

    declare

    @year int,

    @month int

    set @year=2009

    set @month=4

    SELECT

    IncidentMode,

    Count(IncidentMode) AS ModeCount,

    DATEPART (yy,CreatedDate) as CurrentModeYear,

    CASE

    WHEN DATEPART (mm,CreatedDate) = 3 THEN 'March'

    WHEN DATEPART (mm,CreatedDate) = 4 THEN 'April'

    END

    AS...

Viewing 14 posts - 1 through 14 (of 14 total)