Forum Replies Created

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

  • RE: Looping

    Jordon, where is the last number stored, if not in the table you are inserting to? I see an immediate conflict if you are inserting a set of...

  • 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.

  • 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...

  • 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,...

  • 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

    ...

  • RE: Looping

    Welcome Newbie !! 🙂

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

    ...

  • RE: Looping

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

  • RE: Are the posted questions getting worse?

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

  • 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

  • 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.

  • 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. ...

  • 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...

  • 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...

  • 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...

  • 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...

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