June 21, 2007 at 7:08 am
Any ideas how can take the results of the following statement and insert it into a temp table:
LTRIM(STR(@@ROWCOUNT))+' disposition records inserted.'
For example the row would contain '1444 Disposition records inserted.'
I created a temp table as follows:
CREATE TABLE #Log (messagecount VARACHAR (100)) and now I need to insert into it.
Thanks,
Art
June 21, 2007 at 7:34 am
declare
@msg varchar(100)
set
@msg = LTRIM(STR(@@ROWCOUNT))+' disposition records inserted.'
insert
into #Log values (@msg)
--james
June 21, 2007 at 7:35 am
Ummmm, why can't you just use a simple insert statement????
INSERT INTO #Log (MessageCount)
SELECT LTRIM(STR(@@ROWCOUNT))+' disposition records inserted.'
--Jeff Moden
Change is inevitable... Change for the better is not.
June 21, 2007 at 8:11 am
I took Jeff idea and ran with it. Its working fine now.
Thanks for all the input.
June 21, 2007 at 8:39 am
Hmm, I guess that works too.
June 21, 2007 at 9:04 am
Arthur,
The only thing that you have to remember is that if anything comes between the statement that creates the row count and the insert, then you'll need to use James' method because @@ROWCOUNT contains the rowcount of whatever the last statement before it's use was.
James,
Heh, that wasn't directed at you... you just posted before I did so it looks that way...
--Jeff Moden
Change is inevitable... Change for the better is not.
June 21, 2007 at 9:32 am
Jeff: No problem, it actually applied to me too, when I saw your post it was a "Duh! why didn't I think of that" moment
James.
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply