Forum Replies Created

Viewing 15 posts - 16 through 30 (of 136 total)

  • RE: Select with column names - syntax

    Thanks for the compliments. I like it when people find my posts helpful.

    Rob

    Rob Farley
    LobsterPot Solutions & Adelaide SQL Server User Group
    Company: http://www.lobsterpot.com.au
    Blog: http://blogs.lobsterpot.com.au

  • RE: Each GROUP BY expression must contain at least one column that is not an outer reference.

    It's "Arun" and "Rob". You're reading the forum status (like yours is "Forum Newbie")

    Rob Farley
    LobsterPot Solutions & Adelaide SQL Server User Group
    Company: http://www.lobsterpot.com.au
    Blog: http://blogs.lobsterpot.com.au

  • RE: Each GROUP BY expression must contain at least one column that is not an outer reference.

    I assume you have columns called Date and Amount in each of your tables dbo.hardware and dbo.accessories...

    Rob Farley
    LobsterPot Solutions & Adelaide SQL Server User Group
    Company: http://www.lobsterpot.com.au
    Blog: http://blogs.lobsterpot.com.au

  • RE: Each GROUP BY expression must contain at least one column that is not an outer reference.

    Get rid of your apostrophes. It thinks you're talking about the string 'MonthYear', not the column within your query.

    SELECT MonthYear....

    FROM

    (

    SELECT ... AS MonthYear, ...

    )...

    GROUP BY MonthYear

    Rob Farley
    LobsterPot Solutions & Adelaide SQL Server User Group
    Company: http://www.lobsterpot.com.au
    Blog: http://blogs.lobsterpot.com.au

  • RE: Calculating Age

    Tim,

    Exactly!

    Suppose the case of my friend, who is born on May 11th, 1993. On their 18th birthday, the system using 365.25 will declare them still 17 - which can get...

    Rob Farley
    LobsterPot Solutions & Adelaide SQL Server User Group
    Company: http://www.lobsterpot.com.au
    Blog: http://blogs.lobsterpot.com.au

  • RE: Calculating Age

    GSquared, you're welcome. Hope that method works for you (YYYYMMDD).

    Rob

    Rob Farley
    LobsterPot Solutions & Adelaide SQL Server User Group
    Company: http://www.lobsterpot.com.au
    Blog: http://blogs.lobsterpot.com.au

  • RE: Calculating Age

    Mine is just looking at the principle of:

    Suppose your birthday is 19490713. Suppose today is 20090313.

    Subtract one from the other, and you get:

    20090313-19490713 = 599600

    Divide by 1000 to see that...

    Rob Farley
    LobsterPot Solutions & Adelaide SQL Server User Group
    Company: http://www.lobsterpot.com.au
    Blog: http://blogs.lobsterpot.com.au

  • RE: Calculating Age

    Can I suggest an alternative?

    Convert the strings into a number in the format YYYYMMDD (as you would for a data warehouse), and then just subtract one from the other. Strip...

    Rob Farley
    LobsterPot Solutions & Adelaide SQL Server User Group
    Company: http://www.lobsterpot.com.au
    Blog: http://blogs.lobsterpot.com.au

  • RE: The Power of Merge

    Yes, it's faster. It doesn't need to loop through the data multiple times to find out which rows exist and therefore need updating, and which ones don't and therefore need...

    Rob Farley
    LobsterPot Solutions & Adelaide SQL Server User Group
    Company: http://www.lobsterpot.com.au
    Blog: http://blogs.lobsterpot.com.au

  • RE: Mathematical T-SQL

    It's really simple - check out Books Online

    http://msdn2.microsoft.com/en-us/library/bb933952(SQL.100).aspx

    Rob Farley
    LobsterPot Solutions & Adelaide SQL Server User Group
    Company: http://www.lobsterpot.com.au
    Blog: http://blogs.lobsterpot.com.au

  • RE: Mathematical T-SQL

    Can I do a quick plug for the new Spatial types in SQL2008 here? You can use them to find the distance between two points quite easily.

    Rob Farley
    LobsterPot Solutions & Adelaide SQL Server User Group
    Company: http://www.lobsterpot.com.au
    Blog: http://blogs.lobsterpot.com.au

  • RE: Averaging between days

    If you actually want to have a query which returns the number of days between days, then I suggest you use something like:

    with l as

    (select *, row_number() over (partition by...

    Rob Farley
    LobsterPot Solutions & Adelaide SQL Server User Group
    Company: http://www.lobsterpot.com.au
    Blog: http://blogs.lobsterpot.com.au

  • RE: Management Studio with SQL Server 2000

    Greg,

    Can you connect to that same server from your client using Enterprise Manager? That error may suggest that the installation of SQL Server may not be letting anyone connect to...

    Rob Farley
    LobsterPot Solutions & Adelaide SQL Server User Group
    Company: http://www.lobsterpot.com.au
    Blog: http://blogs.lobsterpot.com.au

  • RE: The Power of Merge

    Yes Leo, that's correct.

    Rob Farley
    LobsterPot Solutions & Adelaide SQL Server User Group
    Company: http://www.lobsterpot.com.au
    Blog: http://blogs.lobsterpot.com.au

  • RE: The Power of Merge

    But why use XML to pass data in, when SQL2008 gives you Table-Value Parameters?

    (I do love Merge - I spoke on it last month at the UG I run, and...

    Rob Farley
    LobsterPot Solutions & Adelaide SQL Server User Group
    Company: http://www.lobsterpot.com.au
    Blog: http://blogs.lobsterpot.com.au

Viewing 15 posts - 16 through 30 (of 136 total)