Forum Replies Created

Viewing 15 posts - 841 through 855 (of 2,007 total)

  • RE: how to get the data week wise in sql server

    narendra.babu57 (3/1/2012)


    Hi,

    Some dates it will coming invalid. Why it happen?

    For example 29-10-2011,30-08-2011 dates... --it will come Invalid

    You said your dates were in this format -- 10/29/2011. So I coded the...

  • RE: Work out which column value is repeated the most

    sku370870 (3/1/2012)


    Wow, thanks very much. Yes, that's exactly what I need.

    Seeing your code makes me realise what a novice I am at this lark.

    Can I ask ...

    Using that 'With' statement,...

  • RE: Weird DELETE statement or is legit?

    It's the syntax used to delete using a subquery.

  • RE: Avoiding a Cursor

    five_ten_fiftyfold (2/29/2012)


    I guess sometimes you need to dance with the Devil 🙂

    Again, nope. You could use FOR XML to generate your SQL dynamically then execute it.

    e.g.

    DECLARE @sql AS NVARCHAR(MAX);

    SELECT @sql...

  • RE: how to get the data week wise in sql server

    Lowell (2/29/2012)


    I am so stupid;

    I had no idea I could go to Object Explorer>>Specific Database>> Programmability>>Assemblies and script them out.

    I'd always take a model and copy/pasted all the pieces into...

  • RE: @Yearmonth ?

    No, because the @YEARMONTH is an INT. So in my example, 20000101, represents the 1st Jan 2000, but when we minus 93 from the @YEARMONTH we get 20000008 which...

  • RE: Another user's avatar block

    Not sure I'd go so far as to say I hate it, but I do think it's a bit too graphic for a professional forum.

  • RE: how to get the data week wise in sql server

    Lowell (2/29/2012)


    Cadavre my friend how do you script your clr to be the binary string like that?

    what's the trick?

    i've only done it manually so far, nd it's a pain....load...

  • RE: @Yearmonth ?

    You've not shown where @Yearmonth is declared or assigned. Nor have you shown DDL for the tables involved.

    WHERE (RTRIM(YEAR(A.DOCDATE)) + RIGHT('0' + CONVERT(VARCHAR, MONTH(A.DOCDATE)), 2) <= @YEARMONTH) AND

    (RTRIM(YEAR(A.DOCDATE)) +...

  • RE: @Yearmonth ?

    It depends on the context.

  • RE: how to get the data week wise in sql server

    narendra.babu57 (2/29/2012)


    hi bellow format is mix with another month also but i need separate month wise

    Fairly certain that you won't have the same issue with my CLR.

    As I see...

  • RE: how to get the data week wise in sql server

    Sample data:-

    SELECT date, cnt, Empcode

    INTO QMaster

    FROM (VALUES(N'2/2/2011', 1, 101),(N'2/2/2011', 1, 102),

    (N'2/4/2011', 1, 103),(N'2/4/2011', 1, 104),(N'2/6/2011', 1, 105),

    (N'2/6/2011', 1, 106),(N'2/8/2011', 1, 107),(N'2/9/2011', 1, 108),

    (N'2/10/2011', 1, 109),(N'2/11/2011', 1, 110),(N'2/11/2011', 1, 111),

    (N'2/24/2011', 1,...

  • RE: Avoiding a Cursor

    five_ten_fiftyfold (2/29/2012)


    Interesting...

    Does this mean I'm going to have to use a cursor for this operation, one way or another?

    You could create your scripts dynamically into a variable then use sp_executesql...

  • RE: Another user's avatar block

    You can block all avatars in control panel -> forum settings.

  • RE: Column Alias name dynamically

    fahey.jonathan (2/24/2012)


    I agree that your version is faster, but not by the margin indicated. Most of the difference is created by the ORDER BY clause in "my" code, which...

Viewing 15 posts - 841 through 855 (of 2,007 total)