Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Nest stored procedure

Author  Topic 

acdacd
Yak Posting Veteran

63 Posts

Posted - 2005-08-25 : 11:47:58
I wuold like to write a stored procedure. Within this proc, i want to call other stored procedure to fill data into temp table, however error exist as

"Server: Msg 156, Level 15, State 1, Line 13
Incorrect syntax near the keyword 'exec'.
Server: Msg 170, Level 15, State 1, Line 13
Line 13: Incorrect syntax near ')'."

What is the problem?

Thx!

/******************/

Declare @JobTitle varchar(50)

set @JobTitle = 'test'

create table #TempTable11
(
[JobAlertSearchID] [int] IDENTITY (1, 1) NOT NULL ,
[JobTitle] [varchar] (50) COLLATE Chinese_Taiwan_Stroke_CI_AS NULL
)
Insert into #TempTable11(JobTitle)
--values -- (i have try add values but erro still exist)
(
(exec dbo.NSearchJob 'test' )
)

select * from #TempTable11
drop table #TempTable11

--in "NSearchJob" which is stored proc
-- only common select query : select JobTitle Form Jobs


be a hardworking people!!

Kristen
Test

22859 Posts

Posted - 2005-08-25 : 12:24:11
Not sure about the brackets, I think you just need

Insert into #TempTable11(JobTitle)
exec dbo.NSearchJob 'test'

but the columns in #TempTable11 must exactly match the resultset from the Sproc

Kristen
Go to Top of Page

acdacd
Yak Posting Veteran

63 Posts

Posted - 2005-08-25 : 12:31:48
Thank!
The "()" should be omit!
knowing this fact make me feel frustrated about sql programme

be a hardworking people!!
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2005-08-25 : 13:26:38
"knowing this fact make me feel frustrated about sql programme"

... but good about SQL Team

Kristen
Go to Top of Page
   

- Advertisement -