Viewing 15 posts - 2,206 through 2,220 (of 4,081 total)
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...
October 16, 2009 at 8:04 am
We got another procedural junkie here. I have to go. Somebody please help me turn him from the dark side.
October 15, 2009 at 3:05 pm
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...
October 15, 2009 at 3:04 pm
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,...
October 15, 2009 at 2:49 pm
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
...
October 15, 2009 at 2:32 pm
Welcome Newbie !! 🙂
I will counsel you to turn away from the dark side of procedural thinking and embrace the set-based truth.
...
October 15, 2009 at 2:26 pm
Where's the loop? I see no WHILE statement before the BEGIN.
October 15, 2009 at 2:18 pm
It depends. But I think that this would be a good question to put over on askSSC.
October 15, 2009 at 1:31 pm
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
October 15, 2009 at 12:31 pm
Nah... he just mutated SOM into SOB... which I thoroughly enjoyed BTW.
Hope you're having a good vacation, Lynn.
October 14, 2009 at 5:07 pm
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. ...
October 14, 2009 at 4:43 pm
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...
October 14, 2009 at 4:32 pm
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...
October 14, 2009 at 3:01 pm
I'm still not quite clear. Would you please do us a favor? Amend your sample data (which was very nicely scripted and we...
October 14, 2009 at 2:56 pm
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...
October 14, 2009 at 2:43 pm
Viewing 15 posts - 2,206 through 2,220 (of 4,081 total)