Forum Replies Created

Viewing 15 posts - 586 through 600 (of 1,228 total)

  • RE: convert '1 - Apr' to datetime

    captcooldaddy (1/17/2012)


    sorry. it's coming in a different column

    select replace('1 - Apr',' ','') dt, 2010 [year]

    into #test

    select dt,year --how do i convert this varchar to a datetime

    from #test

    Can you set up...


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: convert '1 - Apr' to datetime

    What year?


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: Violation of PRIMARY KEY constraint

    sami.sqldba (1/17/2012)


    Hi

    Try this it will make you insert from other table and id starting with 1000000

    DECLARE @START INT

    DECLARE @END INT

    SELECT @START = 1000000 --START VALUE

    SET @END = (SELECT COUNT(*)...


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: Help with Counts

    How do I copy code from the forum to paste into Management studio, without having to refomat it myself everytime?

    Paste it into a word document, then copy and paste again....


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: Help with Counts

    bicky1980 (1/17/2012)


    The datakey & landline doesnt exist in my final table

    That's going to happen - can you post the results of the query I posted last?

    I edited the query at...


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: Help with Counts

    bicky1980 (1/17/2012)


    The Query does however, appear to exclude some records, which I cant explain.

    I had 4 records with the same datakey and same landline, but these results were excluded from...


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: Help with Counts

    Hi Bickie

    Here's a solution which seems to work with an extended sample data set.

    Sample data:

    DROP TABLE #test2

    CREATE TABLE #test2 (indkey NVARCHAR(2), datakey NVARCHAR(4),...


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: Help with Counts

    bicky1980 (1/16/2012)


    ...

    And what does that mean?

    They're solutions to a particular type of problem, well known and defined, and I think it's fair to say that one or two folks will...


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: Help with Counts

    SQLKnowItAll (1/16/2012)


    bicky1980 (1/16/2012)


    SQLKnowItAll (1/16/2012)


    You have this:

    insert into test2

    values ('18','0014','01234567125','','9@test.co.uk')

    insert into test2

    values ('19','0014','01234567126','','9@test.co.uk')

    Then this is 1 unique landline?

    You have this:

    insert into test2

    values ('18','0014','01234567126','','9@test.co.uk')

    insert into test2

    values ('19','0014','01234567126','','9@test.co.uk')

    This is 1 unique landline?

    You have...


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: Help with Counts

    Can you give this a whirl please Bicky, using a decent-sized dataset rather than the somewhat diminutive sample data set? Cheers.

    DROP TABLE #test2

    CREATE TABLE #test2 (indkey NVARCHAR(2),...


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: Help with Counts

    Mark-101232 (1/16/2012)


    bicky1980 (1/16/2012)


    Hi Everyone, Thanks for all your help with this query.

    With ChrisM's help, I think I now have the solution:

    CREATE TABLE #test2 (indkey NVARCHAR(2), ...


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: find diference between two fields

    SELECT

    od.productid,

    od.orderid,

    so.custid,

    so.empid,

    od.discount,

    od.unitprice, -- what do you see here?

    pp.unitprice, -- what do you see here?

    od.unitprice - pp.unitprice AS Profit -- does the calculation make sense now?

    FROM...


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: will it work?

    niha.736 (1/16/2012)


    Hi all,

    If a table contain no records and if I write the statement as insert in functions and I also written it in the stored procedure, so, what will...


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: Help with Counts

    bicky1980 (1/16/2012)


    ChrisM@home (1/13/2012)


    bicky1980 (1/13/2012)


    ...

    Thanks for the reply, if there were 2 duplicate datakeys with different landline values, I would only want this to be counted as one record, as I...


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: Select Query - need optimization

    SQL Kiwi (1/15/2012)


    The error about the engine not being able to obtain a LOCK resource is a consequence of a server with a small amount of configured memory, and an...


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

Viewing 15 posts - 586 through 600 (of 1,228 total)