Forum Replies Created

Viewing 15 posts - 58,681 through 58,695 (of 59,066 total)

  • RE: Date Range

    Subhash,

    For the first problem, use the UNION query you made as if it were a table and do the GROUP BY on that... like this...

     SELECT d.EmpNo, SUM(d.Sal) AS...

  • RE: Variables with Use statements.

    declare @dbname varchar(100)

        set @dbname = 'Some Database'

    DECLARE @sql VARCHAR(8000)

        SET @sql = 'use ' + @dbname

                 + ' dbcc shrinkfile (''File'', Size)'

       EXEC (@SQL)

    ...should work for what...

  • RE: Incrementing a value with a set based solution

    I don't beleive that moving the SELECT into a transaction will prevent others from writing to the target table and, therefore, will not prevent you from inserting a duplicate ID...

  • RE: Incrementing a value with a set based solution

    First, I agree with Remi 100% but those darned 3rd party dummies just keep writing junk and selling it.  Worse yet, we keep buying it

    I'll probably get a...

  • RE: Accurate datediff by years

    The problem isn't that DATEDIFF subtracts years... it's that it counts the number of times the date changes from 12/31 to 01/01.  Subtle difference but very important using other date...

  • RE: Splitting and aggregating a field with commas

    Wasn't that lucky... it's 24/7.  We get to bounce the server once a week for "impacting changes" for about 30 minutes... then, QA get's to verify what we've done.  Of...

  • RE: Splitting and aggregating a field with commas

    Yeah, I wish I didn't need it!  Wonderful 3rd party solution at work.  Bunch o' DB rookies... these are the same wonderful folks that built an Oracle-Like sequence table (NextID)...

  • RE: Splitting and aggregating a field with commas

    Hang on there, Paully21, I'll get to you in a minute...

    I absolutely agree with everyone that having CSV columns in a table is a basic form of "death by SQL". ...

  • RE: db creation

    LMBO!  Both at the design and your great sense of humor which allows you to calmly handle the mess they've heaped upon you!  I don't know about anyone else, but your...

  • RE: Finding weekdays of a given month

    Dang!  I must be old!  None of the newer online slang dictionaries has SOFH or BSOFH!  Remi, where did you find that definition?

  • RE: Finding weekdays of a given month

    Ok, ok... you got me... I've got dirt in my garden that's younger than I am... As you can tell, though, I've had...

  • RE: LIKE condition

    Remi is correct... it takes the original description and wraps it in single spaces.  Basically, it allows this single search ('% myword %') to work on the following descriptions...

    something myword...

  • RE: db creation

    Ok... but the scenario you just stated exactly fits the methods I suggested... whatever.

    To answer your original question, you need to use some Dynamic SQL to do what you want......

  • RE: LIKE condition

    Here's a way to avoid the table scan...

    select * from task where Descr LIKE '% myword %' OR Descr LIKE 'myword %' OR Descr LIKE '% myword'+char(10)+'%'

    If you...

  • RE: db creation

    IMHO, archiving data into separate monthly named databases is one of the worst things you could do... they (3rd party provider) did the same thing were I work and it's...

Viewing 15 posts - 58,681 through 58,695 (of 59,066 total)