Forum Replies Created

Viewing 15 posts - 406 through 420 (of 516 total)

  • RE: Converting Daily data to Weekly data Sql Server 2005

    Try putting Year end date as first friday of next year and check the results.

    And I am not able to see your screen attachment, Please post again.

    Thanks

  • RE: Converting Daily data to Weekly data Sql Server 2005

    One more thing, i missed above

    DECLARE @year_start DATETIME = '02-JAN-2012' --First Monday of the year

    DECLARE @year_end DATETIME = '31-DEC-2012'

    @Year_start is the first Monday of the year. End...

  • RE: Converting Daily data to Weekly data Sql Server 2005

    Here you go....

    I have modified the Data Script to add one more week for both Microsoft and Infosys

    CREATE TABLE NseData

    (

    symbolid bigint,

    symbol varchar(200),

    stimestamp datetime,

    sopen numeric(18, 2),

    shigh numeric(18, 2),

    slow numeric(18, 2),

    sclose numeric(18,...

  • RE: Syntax help

    Jpotucek (7/27/2012)


    Once again.. thank you all for your support!!!!

    select * from iaxChecksCurrent where cast(UploadDate as varchar(10)) like '%2012-07-18%'

    This returned zero rows

    SELECT * FROM iaxChecksCurrent

    WHERE

    CONVERT(varchar(10),UploadDate,120) =...

  • RE: group by roll up

    Lokesh Vij (7/28/2012)


    select empid,

    datepart(yyyy,orderdate) [Year],

    datepart(mm,orderdate) [Month]

    ,SUM(qty) [TotalQty]

    from Orders

    Group by empid,datepart(yyyy,orderdate),datepart(mm,orderdate)

    WITH ROLLUP;

    Needless to say, you need to expend this in you pivot for your result.

  • RE: group by roll up

    select empid,

    datepart(yyyy,orderdate) [Year],

    datepart(mm,orderdate) [Month]

    ,SUM(qty) [TotalQty]

    from Orders

    Group by empid,datepart(yyyy,orderdate),datepart(mm,orderdate)

    WITH ROLLUP;

  • RE: Converting Daily data to Weekly data Sql Server 2005

    As you are new to this forum try to know the best practices in order to get quicker answers on T-SQL questions, Follow this link

    http://www.sqlservercentral.com/articles/Best+Practices/61537/

    Cheers

    Lokesh

  • RE: Converting Daily data to Weekly data Sql Server 2005

    CREATE TABLE NseData

    (

    symbolid bigint,

    symbol varchar(200),

    stimestamp datetime,

    sopen numeric(18, 2),

    shigh numeric(18, 2),

    slow numeric(18, 2),

    sclose numeric(18, 2),

    tottrdqty bigint

    )

    INSERT INTO NseData

    VALUES

    (1,'Microsoft','Jul, 23 2012',42.00,43.5,38.25,43,10),

    (1,'Microsoft','Jul, 24 2012',43.25,44.75,39.50,44.25,20),

    (1,'Microsoft','Jul, 25 2012',44.50,46.00,40.75,45.50,30),

    (1,'Microsoft','Jul, 26 2012',45.75,47.25,42.00,46.75,10),

    (1,'Microsoft','Jul, 27 2012',47.00,48.50,43.25,48.00,20),

    (2,'Infosys','Jul, 23 2012',48.25,49.75,44.50,49.25,30),

    (2,'Infosys','Jul,...

  • RE: Best Practices to import excel data into sql server?

    Alan Kwan (7/27/2012)


    Just tried the code you provided, still the same error.

    SELECT * FROM OPENROWSET('Microsoft.ACE.OLEDB.12.0', 'Excel 12.0; Database = C:\abc.eeee.xls', 'Select * FROM [Sheet1$]')

    Same Error 🙁

    Try using SSIS then. Its...

  • RE: Difficulty with a SELECT statement

    First of all, your table ISIR should have enr_id added otherwise it does not make any sense to have two dateadded fields for one stu_id

    Here is one more way to...

  • RE: Passing conditional where clause ?

    Wonderful article Capn. Thanks for sharing.

  • RE: Index Rebuild Vs Reorganize...?

    lrutkowski (7/27/2012)


    You really only need to reorganize or rebuild, depending on how much fragmentation you have on your indexes, although you can do it as often as you like, if...

  • RE: Combining two rows to get one result

    Few days back, I posted how to combine two consecutive rows and find result. Pls have a look, might be useful:

    http://sqlpathy.wordpress.com/2012/07/22/operating-on-consecutive-rowscolumns/

    I am sure there are many ways of doing a...

  • RE: next day function

    Yes agreed. This can only be used for datetime.

    I was just trying to show one more way of doing it 🙂

  • RE: Passing conditional where clause ?

    Sean Lange (7/26/2012)


    capn.hector (7/26/2012)


    vchandm23 (7/25/2012)


    CREATE PROCEDURE [dbo].[myProc]

    @whereSql nvarchar(256)

    AS

    EXEC('SELECT [fields] FROM WHERE ' + @whereSql)

    GO

    From stackOverflow website. This is what i was looking for. I am...

Viewing 15 posts - 406 through 420 (of 516 total)