hi!
I have a stored proc which aggregates some values and
returns a recordset with one record
...looking something like this:
val1 val2 val3
-- -- --
24723 26457 342579
how can I use this record for further processing
e.g. write it into an existing table (for logging)
hmm, this is probably a newbie-question
but I couldnt find the answer in BOL...
any help is greatly appreciated,
best regards,
haraldIf you want to handle only one record you can use variables to store and use
it.
For eg:
Declare @.Val1 int , @.Val2 int ...
Select @.Val1 = Val1, @.Val2 = Val2 etv...
Insert into TableName (@.Val1, @.val2 etc..
Other wise you can use a cursor for looping it.
Please refer books online.
Thank you
Baiju
"Harald Peki" <mabuse007@.yahoo.com> wrote in message
news:1109832522.363076@.news.liwest.at...
> hi!
> I have a stored proc which aggregates some values and
> returns a recordset with one record
> ...looking something like this:
> val1 val2 val3
> -- -- --
> 24723 26457 342579
> how can I use this record for further processing
> e.g. write it into an existing table (for logging)
>
> hmm, this is probably a newbie-question
> but I couldnt find the answer in BOL...
> any help is greatly appreciated,
> best regards,
> harald
>
>|||hello baiju,
thanks very much - I am aware of cursors, but hoped there would be a
easier and more elegant solution.
generally asked: isnt there a way to use the storedproc-recordset in the
same
way like the resultset of a function which returns a table?
I this case I can use a statement like this:
INSERT INTO StatsTables
SELECT * FROM dbo.adm_CountAllTables_function()
...where dbo.adm_CountAllTables_function() is - obviously ;))) - a
function...
hmm, I guess it IS the most usefull solution to change the storedproc to a
function.
Im most thankful for any further comments.
best regards,
harald
"Baiju" <baiju@.indus-systems.com> schrieb im Newsbeitrag
news:uhfN$f8HFHA.4032@.TK2MSFTNGP12.phx.gbl...
> If you want to handle only one record you can use variables to store and
use
> it.
> For eg:
> Declare @.Val1 int , @.Val2 int ...
> Select @.Val1 = Val1, @.Val2 = Val2 etv...
> Insert into TableName (@.Val1, @.val2 etc..
>
> Other wise you can use a cursor for looping it.
> Please refer books online.
>
> Thank you
> Baiju
>
> "Harald Peki" <mabuse007@.yahoo.com> wrote in message
> news:1109832522.363076@.news.liwest.at...
>|||use
insert into table_name
exec proc_name
"Harald Peki" wrote:
> hi!
> I have a stored proc which aggregates some values and
> returns a recordset with one record
> ...looking something like this:
> val1 val2 val3
> -- -- --
> 24723 26457 342579
> how can I use this record for further processing
> e.g. write it into an existing table (for logging)
>
> hmm, this is probably a newbie-question
> but I couldnt find the answer in BOL...
> any help is greatly appreciated,
> best regards,
> harald
>
>|||hi tom!
> insert into table_name
> exec proc_name
oops! great!!!
...but funny...tried that one but obviously had some syntax mistake or
something...
WORKS GREAT NOW!!
Thanks very, very much!
all systems up and running ;))
best regards,
harald
"Tomasz Borawski" <TomaszBorawski@.discussions.microsoft.com> schrieb im
Newsbeitrag news:4895E3C4-C967-46BB-99F4-54724C98CE71@.microsoft.com...
> use
> insert into table_name
> exec proc_name
>
> "Harald Peki" wrote:
>
Showing posts with label recordset. Show all posts
Showing posts with label recordset. Show all posts
Wednesday, March 7, 2012
process result recordset from storedproc
Process on Linked Server doesn't stop
Hello,
I have the same problem with Linked Server. I receive recordset from stored
procedure, which executes inside it stored procedure on the Linked Server. If
the application, that run stored procedure work successfully, then everything
is OK, but if there are some troubles (e.g. I close the parent application,
before I get recordset), I have the problem: the process on the Linked Server
doesn’t stop itself. It’s continuing executing for eternity and locks other
processes. The only way to stop it – is to kill it. I’ll try to set timeouts
in the configuration of my application
and Query Timeout in the Server Options of Linked Server, but it doesn’t
help. This problem shows itself only if I work through Linked Server.
Thanks for your help.
Boris.
Seems to me that if you were to close the application "unexpectedly", then
it leaves an orphaned transaction which probably would explain the
behaviour you are seeing. You might want to consider making some
application code changes that has some sort of logic on open transactions
from the client end, and to close them on an exit, or some such thing.
HTH!
Vikram Jayaram
Microsoft, SQL Server
This posting is provided "AS IS" with no warranties, and confers no rights.
Subscribe to MSDN & use http://msdn.microsoft.com/newsgroups.
I have the same problem with Linked Server. I receive recordset from stored
procedure, which executes inside it stored procedure on the Linked Server. If
the application, that run stored procedure work successfully, then everything
is OK, but if there are some troubles (e.g. I close the parent application,
before I get recordset), I have the problem: the process on the Linked Server
doesn’t stop itself. It’s continuing executing for eternity and locks other
processes. The only way to stop it – is to kill it. I’ll try to set timeouts
in the configuration of my application
and Query Timeout in the Server Options of Linked Server, but it doesn’t
help. This problem shows itself only if I work through Linked Server.
Thanks for your help.
Boris.
Seems to me that if you were to close the application "unexpectedly", then
it leaves an orphaned transaction which probably would explain the
behaviour you are seeing. You might want to consider making some
application code changes that has some sort of logic on open transactions
from the client end, and to close them on an exit, or some such thing.
HTH!
Vikram Jayaram
Microsoft, SQL Server
This posting is provided "AS IS" with no warranties, and confers no rights.
Subscribe to MSDN & use http://msdn.microsoft.com/newsgroups.
Process on Linked Server doesn't stop
Hello,
I have the same problem with Linked Server. I receive recordset from stored
procedure, which executes inside it stored procedure on the Linked Server. If
the application, that run stored procedure work successfully, then everything
is OK, but if there are some troubles (e.g. I close the parent application,
before I get recordset), I have the problem: the process on the Linked Server
doesnâ't stop itself. Itâ's continuing executing for eternity and locks other
processes. The only way to stop it â' is to kill it. Iâ'll try to set timeouts
in the configuration of my application
and Query Timeout in the Server Options of Linked Server, but it doesnâ't
help. This problem shows itself only if I work through Linked Server.
Thanks for your help.
Boris.Seems to me that if you were to close the application "unexpectedly", then
it leaves an orphaned transaction which probably would explain the
behaviour you are seeing. You might want to consider making some
application code changes that has some sort of logic on open transactions
from the client end, and to close them on an exit, or some such thing.
HTH!
Vikram Jayaram
Microsoft, SQL Server
This posting is provided "AS IS" with no warranties, and confers no rights.
Subscribe to MSDN & use http://msdn.microsoft.com/newsgroups.
I have the same problem with Linked Server. I receive recordset from stored
procedure, which executes inside it stored procedure on the Linked Server. If
the application, that run stored procedure work successfully, then everything
is OK, but if there are some troubles (e.g. I close the parent application,
before I get recordset), I have the problem: the process on the Linked Server
doesnâ't stop itself. Itâ's continuing executing for eternity and locks other
processes. The only way to stop it â' is to kill it. Iâ'll try to set timeouts
in the configuration of my application
and Query Timeout in the Server Options of Linked Server, but it doesnâ't
help. This problem shows itself only if I work through Linked Server.
Thanks for your help.
Boris.Seems to me that if you were to close the application "unexpectedly", then
it leaves an orphaned transaction which probably would explain the
behaviour you are seeing. You might want to consider making some
application code changes that has some sort of logic on open transactions
from the client end, and to close them on an exit, or some such thing.
HTH!
Vikram Jayaram
Microsoft, SQL Server
This posting is provided "AS IS" with no warranties, and confers no rights.
Subscribe to MSDN & use http://msdn.microsoft.com/newsgroups.
Process on Linked Server doesn't stop
Hello,
I have the same problem with Linked Server. I receive recordset from stored
procedure, which executes inside it stored procedure on the Linked Server. I
f
the application, that run stored procedure work successfully, then everythin
g
is OK, but if there are some troubles (e.g. I close the parent application,
before I get recordset), I have the problem: the process on the Linked Serve
r
doesn’t stop itself. It’s continuing executing for eternity and locks ot
her
processes. The only way to stop it – is to kill it. I’ll try to set time
outs
in the configuration of my application
and Query Timeout in the Server Options of Linked Server, but it doesn’t
help. This problem shows itself only if I work through Linked Server.
Thanks for your help.
Boris.Seems to me that if you were to close the application "unexpectedly", then
it leaves an orphaned transaction which probably would explain the
behaviour you are seeing. You might want to consider making some
application code changes that has some sort of logic on open transactions
from the client end, and to close them on an exit, or some such thing.
HTH!
Vikram Jayaram
Microsoft, SQL Server
This posting is provided "AS IS" with no warranties, and confers no rights.
Subscribe to MSDN & use http://msdn.microsoft.com/newsgroups.
I have the same problem with Linked Server. I receive recordset from stored
procedure, which executes inside it stored procedure on the Linked Server. I
f
the application, that run stored procedure work successfully, then everythin
g
is OK, but if there are some troubles (e.g. I close the parent application,
before I get recordset), I have the problem: the process on the Linked Serve
r
doesn’t stop itself. It’s continuing executing for eternity and locks ot
her
processes. The only way to stop it – is to kill it. I’ll try to set time
outs
in the configuration of my application
and Query Timeout in the Server Options of Linked Server, but it doesn’t
help. This problem shows itself only if I work through Linked Server.
Thanks for your help.
Boris.Seems to me that if you were to close the application "unexpectedly", then
it leaves an orphaned transaction which probably would explain the
behaviour you are seeing. You might want to consider making some
application code changes that has some sort of logic on open transactions
from the client end, and to close them on an exit, or some such thing.
HTH!
Vikram Jayaram
Microsoft, SQL Server
This posting is provided "AS IS" with no warranties, and confers no rights.
Subscribe to MSDN & use http://msdn.microsoft.com/newsgroups.
Subscribe to:
Posts (Atom)