Forum Replies Created

Viewing 15 posts - 2,986 through 3,000 (of 14,953 total)

  • RE: Concatenation insde Case Statement

    ChrisM, that's a pretty standard way to get the last day of the previous month, formatted as YYYYMMDD. It doesn't have any columns in it, so you can just...

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • RE: Checking my work

    I do a common-sense check on the data before I send it, but it's just an eyeball-it-quick thing.

    Most of the time, I can safely assume the person consuming the data...

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • RE: Concatenation insde Case Statement

    Don't pad with a case statement.

    Do it like this:

    select right('0000' + @MyStringVariable, 4);

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • RE: Query Optimization

    The simple "sum" function won't work here because you have to group by unique values in order to get the rest of the query to work.

    If you can post the...

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • RE: Audit a login's activity (select, insert,update,delete) against any database

    I uses server-side traces for this.

    Either use Profiler to script the trace, like K. Brian Kelley suggested, or use sp_trace_create and sp_trace_setevent (which is what I do).

    Here's a sample trace...

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • RE: help in query

    Something like this?

    IF OBJECT_ID(N'tempdb..#T') IS NOT NULL

    DROP TABLE #T ;

    CREATE TABLE #T

    (StartDate DATE,

    ID INT,

    ...

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • RE: a ITVF string concatenation without "FOR_XML"

    All other ways of doing this that I know of are either much slower, or require using CLR objects in the database (which would also require the DBA allowing that).

    You...

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • RE: How to find out indexes/constraints physical location ?

    jared-709193 (11/1/2011)


    GSquared (11/1/2011)


    That's good. I was hoping for something on MSDN, but at least that allows testing of the concept.

    Found it! http://msdn.microsoft.com/en-us/library/ms187087.aspx

    Thanks,

    Jared

    Thanks. Knew...

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • RE: Subquery With Aggregates and Pivot

    Yeah, dynamic column-headers is a pain.

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • RE: managing large tables

    There are other ways to write it in T-SQL. "Better" is situational on all of the variations.

    You'll want to take a look at Gail Shaw's blog entry on the...

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • RE: How to find out indexes/constraints physical location ?

    That's good. I was hoping for something on MSDN, but at least that allows testing of the concept.

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • RE: How to find out indexes/constraints physical location ?

    jared-709193 (11/1/2011)


    GSquared (11/1/2011)


    Gail: I was trying to find a reference I could quote for that same answer. I know the data, but I can't remember where I read it....

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • RE: SQL2005 and Ideara SQL Doctor

    It's called "server" because that's what it does.

    There's a good definition at: http://en.wikipedia.org/wiki/Server_(computing)

    It's not limited to OS-ware.

    As for the first question, sorry, no clue. Never used it. What's...

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • RE: How to find out indexes/constraints physical location ?

    Gail: I was trying to find a reference I could quote for that same answer. I know the data, but I can't remember where I read it. Any...

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • RE: BIDS 2008 and SSIS 2005 packages question

    I use the version of BIDS that came with SQL 2008 R2 Dev Edition to build and edit SSIS packages that get deployed to SQL 2005 Standard Edition servers. ...

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

Viewing 15 posts - 2,986 through 3,000 (of 14,953 total)