| Author |
Topic |
|
u2p_inst
Yak Posting Veteran
78 Posts |
Posted - 2003-11-04 : 07:18:39
|
| Dear Teamis possible to passing row from the output stored procedure to a table and how?thanksoh |
|
|
ehorn
Master Smack Fu Yak Hacker
1632 Posts |
Posted - 2003-11-04 : 07:32:36
|
| [code]create proc usp_InsertIntoTableasinsert into table.....[/code] |
 |
|
|
u2p_inst
Yak Posting Veteran
78 Posts |
Posted - 2003-11-04 : 07:56:52
|
| i have try your query and have problem, can you show me in detail(example ?)oh |
 |
|
|
ehorn
Master Smack Fu Yak Hacker
1632 Posts |
Posted - 2003-11-04 : 08:22:51
|
quote: Originally posted by ehorn
create proc usp_InsertIntoTableasinsert into table.....
This is not a query. It is demonstrating that you can run SQL statements inside of a stored procedure, including insert statements.Here is a sample:create table #q (n int identity(0,1),somedata char(4))gocreate proc usp_InsertIntoTable @somevalue char(4)as set nocount on insert into #q select @somevalueGOexec usp_InsertIntoTable 'TEST'select * from #qgodrop table #qdrop proc usp_InsertIntoTable Also, if anyone would like to use this very valuable sp please feel free... But you may want to put some indexes on the table |
 |
|
|
X002548
Not Just a Number
15586 Posts |
Posted - 2003-11-04 : 14:48:42
|
I think they're looking for something like:USE NorthwindGOCREATE TABLE myTable99 (Col1 varchar(1000), Col2 varchar(1000))GOINSERT INTO myTable99 EXEC sp_depends OrdersGOSELECT * FROM myTable99GODROP TABLE myTable99GO Brett8-) |
 |
|
|
u2p_inst
Yak Posting Veteran
78 Posts |
Posted - 2003-11-04 : 21:08:25
|
| i try query like:SELECT * FROM OPENQUERY(LINKEDSERVER, 'EXEC sp_name') WHERE field1 = 'tesss' and the query is workRegarding my question before, is possible to execute query like that in localserver ?Thanksoh |
 |
|
|
Merkin
Funky Drop Bear Fearing SQL Dude!
4970 Posts |
Posted - 2003-11-04 : 21:16:06
|
| You can set up the local server as a linked server.ORFollow Brett's advice above. This is the option I would suggest.Damian |
 |
|
|
u2p_inst
Yak Posting Veteran
78 Posts |
Posted - 2003-11-04 : 22:23:17
|
| it's imposible to create local server as as linked server, i have been tried this and erroroh |
 |
|
|
Merkin
Funky Drop Bear Fearing SQL Dude!
4970 Posts |
Posted - 2003-11-04 : 22:29:59
|
| It's not impossibleLook up "linked servers, loopback linked servers" in Books OnlineDamian |
 |
|
|
Merkin
Funky Drop Bear Fearing SQL Dude!
4970 Posts |
Posted - 2003-11-04 : 22:32:05
|
| By the way, I STILL don't know why you won't insert into a table like Brett's example. Especially seeing as that is what you asked for.Damian |
 |
|
|
u2p_inst
Yak Posting Veteran
78 Posts |
Posted - 2003-11-04 : 23:26:27
|
| thanks for information about loopback linked server before.i wont inset into myTable like brett's script because in brett's query example like :'INSERT INTO myTable99 EXEC sp_depends Orders'The object "Orders" is a table but in my case the object is a stored procedure and the result will error if we change object from table to stored procedureoh |
 |
|
|
mohdowais
Sheikh of Yak Knowledge
1456 Posts |
Posted - 2003-11-05 : 00:32:48
|
oh if you look carefully, Brett is calling a stored procedure, and he is passing "Orders" as a parameter to the sp. You should be able to do this with any SPINSERT INTO TableName EXEC spNameJust make sure that the structure of your table matches the output of the procedure.Owais Where there's a will, I want to be in it. |
 |
|
|
u2p_inst
Yak Posting Veteran
78 Posts |
Posted - 2003-11-05 : 02:39:51
|
| thanks Owais that is work properlyoh |
 |
|
|
|