Forum Replies Created

Viewing 15 posts - 3,481 through 3,495 (of 3,957 total)

  • RE: Generating n-Tuples with SQL

    ChrisM@Work (5/30/2012)


    If you want to make a rCTE run really quickly, then minimise the amount of "r" in it...

    ;WITH rCTE AS

    (

    SELECT [level] = 0

    ...

  • RE: Figuring out NSF payments

    Greg Snidow (5/30/2012)


    Lynn Pettis (5/30/2012)


    you will have to tell me if it is okay.

    Lynn, it's very close. Below is my expected output. The three rows with asterisks are...

  • RE: DATEADD and leap years

    drew.allen (5/30/2012)


    dwain.c (5/29/2012)


    Datetime functions do have their issues though, like the following:

    SELECT DATEADD(month, 1, '2012-02-29')

    Depending on your point of view, the results this returns looks wrong, or maybe not. ...

  • RE: Are the posted questions getting worse?

    Maybe we should start a new thread for oenophiles.

    We could call it the wine cooler thread!:-)

  • RE: Help with query joining 3 tables

    porygon3000 (5/28/2012)


    It doesn't matter if it's not efficient or if it takes a while, it's just a for a really basic school project and this is the only thing that...

  • RE: Help with query joining 3 tables

    Hey Barry!

    Glad you don't think I trod too heavily upon your toes on this one.

    I've read some of your articles and you do excellent work. I was afraid you...

  • RE: Figuring out NSF payments

    Greg Snidow (5/29/2012)


    dwain.c (5/29/2012)


    I am curious why you think this may be solvable with a recursive CTE. I am unable to come up with a recursion formula that would...

  • RE: DATEADD and leap years

    The datetime functions are aware of leap years.

    Your approach seems to work and seems to me to be reasonable.

    Datetime functions do have their issues though, like the following:

    SELECT DATEADD(month, 1,...

  • RE: Figuring out NSF payments

    Greg,

    I just wanted to let you know I took a stab at this last night but I was not able to come up with a simpler query that returned the...

  • RE: Limiting the records?

    I didn't initially see your comments embedded with mine. Let me see if I can clean this up a bit.

    dwain.c (5/29/2012)


    I also suggest:

    - Review your use of Dynamic SQL....

  • RE: Limiting the records?

    Charmer (5/29/2012)


    dwain.c (5/28/2012)


    Charmer (5/28/2012)


    anthony.green (5/28/2012)


    You certainly don't need a CURSOR to do this.

    While I am loathe to admit it, I have a couple of cases where processing a large number...

  • RE: Use a second table to make selections from another table

    vinu512 (5/29/2012)


    You can also do it using simple sub queries:

    --Creating Tables

    Create Table Table1

    (ID int,

    SYMBOL varchar(10),

    DATE Date, PRICE Float,

    VOLUME int )

    Create Table Table2

    (ID int,

    SYMBOL varchar(10),

    COMPANY...

  • RE: Use a second table to make selections from another table

    You can try something like this:

    DECLARE @TABLE1 TABLE

    (ID INT, SYMBOL VARCHAR(4), DATE DATETIME, PRICE MONEY, VOLUME INT)

    DECLARE @TABLE2 TABLE

    (ID INT, SYMBOL VARCHAR(4), COMPANY VARCHAR(100), SECTOR VARCHAR(50))

    INSERT INTO @TABLE1

    SELECT 1,'A','05/24/12',123.45,100500

    UNION ALL...

  • RE: Limiting the records?

    Charmer (5/28/2012)


    anthony.green (5/28/2012)


    cursors have their place when you need to do RBAR but if you can go for set based executions.

    now depending on what your cursor is doing will depend...

  • RE: Help with query joining 3 tables

    RBarryYoung (5/28/2012)


    Something like this should work:

    ;WITH ctePhones AS

    (

    Select cp.id_client,

    cp.number,

    ...

Viewing 15 posts - 3,481 through 3,495 (of 3,957 total)