Forum Replies Created

Viewing 15 posts - 2,206 through 2,220 (of 4,080 total)

  • RE: Are the posted questions getting worse?

    We got another procedural junkie here. I have to go. Somebody please help me turn him from the dark side.

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • RE: Looping

    Jordon, look at how I used the @InsertTime variable in the insert.

    The stuff you want to keep constant, variables are just fine.

    I gotta run. I'm gonna call up...

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • RE: Looping

    You're still thinking procedurally... do the INSERT as a set.

    declare @InsertTimeStamp datetime

    set @InsertTimeStamp = getdate() -- because we don't want this to change

    INSERT INTO dbo.SomeTable (UnitID,AcqCost,AcqDate,AssetDesc,InsertTimeStamp)

    SELECT UNITID,...

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • RE: Add blank spaces in field

    Jordan, you are thinking procedurally here too.

    SQL stores values. Don't worry about formatting until you DISPLAY those values.

    Check this out:

    declare @sample int

    set @sample = 123

    ...

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • RE: Looping

    Welcome Newbie !! 🙂

    I will counsel you to turn away from the dark side of procedural thinking and embrace the set-based truth.

    ...

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • RE: Looping

    Where's the loop? I see no WHILE statement before the BEGIN.

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • RE: Are the posted questions getting worse?

    It depends. But I think that this would be a good question to put over on askSSC.

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • RE: Convert Varchar to Int

    CASE

    WHEN Convert(varchar(13),column1,112) < date1 THEN '1'

    WHEN Convert(varchar(13),column1,112) < date2 THEN '2'

    WHEN Convert(varchar(13),column1,112) < date3 THEN '3'

    WHEN Convert(varchar(13),column1,112) IS NULL THEN '#N/A' ELSE '4'

    END AS Grp

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • RE: Are the posted questions getting worse?

    Nah... he just mutated SOM into SOB... which I thoroughly enjoyed BTW.

    Hope you're having a good vacation, Lynn.

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • RE: Trying to get this to work in one select statement

    Thanks for the explanation Shannon.

    I'm glad you found your solution with PIVOT, but keep the crosstab (CASE) solution in mind if performance becomes an issue. ...

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • RE: Converting DateTimes

    If your [dtTimeStamp] column is indexed, one suggestion would be to retain the [dtTimeStamp] in its original datetime format, and add another column ([GroupByDate]) in your view.

    The...

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • RE: Are the posted questions getting worse?

    What next?

    "You'll have to get the rest of your question answered by someone else... they're about to close the casket, and nobody bothered to put extra batteries in here with...

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • RE: t-sql question

    I'm still not quite clear. Would you please do us a favor? Amend your sample data (which was very nicely scripted and we...

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • RE: Randomly Select Record From Join Result

    This will pick random rows from your table without regard to the sequence of the [NewAccountID] or [Random] columns.

    ;with cte as (select row_number() over(partition by accountid order by newid()) as...

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • RE: Are the posted questions getting worse?

    Which galaxy?

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

Viewing 15 posts - 2,206 through 2,220 (of 4,080 total)