Forum Replies Created

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

  • RE: Help with Counts

    SQLKnowItAll (1/17/2012)


    L' Eomot Inversé (1/17/2012)a set of datakey-landline pairs such that each landline and each datakey occurs only once

    As far as I can tell, this is an impossible statement without...

  • 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...

  • RE: convert '1 - Apr' to datetime

    What year?

  • 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(*)...

  • 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....

  • 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...

  • 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...

  • 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),...

  • 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...

  • 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...

  • 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),...

  • 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), ...

  • 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...

  • 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...

  • 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...

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