April 26, 2012 at 9:39 pm
DECLARE @Table TABLE(
[ID] int,
[CostA] real,
[CostB] real,
[CostC] real
)
INSERT INTO @Table
EXECUTE [dbo].[CostProcedure]
@RootId = @Rootid
@Rate = @Rate
can i do something like this,i am not sure,i can insert sp with param like this?
April 26, 2012 at 9:50 pm
riya_dave (4/26/2012)
DECLARE @Table TABLE([ID] int,
[CostA] real,
[CostB] real,
[CostC] real
)
INSERT INTO @Table
EXECUTE [dbo].[CostProcedure]
@RootId = @Rootid
@Rate = @Rate
can i do something like this,i am not sure,i can insert sp with param like this?
Try it and find out. Just be sure that the result set returned from the procedure has 4 columns.
April 26, 2012 at 11:15 pm
April 27, 2012 at 9:09 am
you can but as lynn said make sure you are returning 4 columns. i would also explicitly define the order (INSERT INTO bla (id,col1,col2) ...) get rid of any mistakes in setting up the table var.
For performance Issues see how we like them posted here: How to Post Performance Problems - Gail Shaw[/url]
Need to Split some strings? Jeff Moden's DelimitedSplit8K[/url]
Jeff Moden's Cross tab and Pivots Part 1[/url]
Jeff Moden's Cross tab and Pivots Part 2[/url]
April 27, 2012 at 12:59 pm
this is not working,
i am calling another sp.
but its not getting into @temp table.
insert into @temp7
EXEC pPortfolioDashboard
@Portfolios = @AdjustPortfolio,
@FromDate = @FromDate,
@ToDate = @ToDate,
whats wrong,how to set values like (col1,col2)
April 27, 2012 at 1:02 pm
Define 'not working'
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
April 27, 2012 at 1:04 pm
riya_dave (4/27/2012)
this is not working,i am calling another sp.
but its not getting into @temp table.
insert into @temp7
EXEC pPortfolioDashboard
@Portfolios = @AdjustPortfolio,
@FromDate = @FromDate,
@ToDate = @ToDate,
whats wrong,how to set values like (col1,col2)
Of course it isn't getting into @temp, you are doing the insert into @temp7.
April 27, 2012 at 1:05 pm
i mean @temp7 ,its not getting into @temp7
April 27, 2012 at 1:07 pm
riya_dave (4/27/2012)
i mean @temp7 ,its not getting into @temp7
Then, as Gail asked, define "not working." Are you getting an error message? If so, how about showing us the error message.
April 27, 2012 at 1:09 pm
i am not getting any error msg,the query is executing indefinite time,
if i put insert into @temp7
without it i am getting data
April 27, 2012 at 1:11 pm
Just means you have a very slow query. Nothing else wrong.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
April 27, 2012 at 1:14 pm
riya_dave (4/27/2012)
i am not getting any error msg,the query is executing indefinite time,if i put insert into @temp7
without it i am getting data
How do you know that the data isn't getting into the table @temp7?
April 27, 2012 at 1:19 pm
but without it i am getting data into seconds ,and with it its running more than 7 minutes ,still not getting data
April 27, 2012 at 1:30 pm
riya_dave (4/27/2012)
but without it i am getting data into seconds ,and with it its running more than 7 minutes ,still not getting data
You really don't want to hear my next comment, because you will just ignore it any way and go on doing what ever it is you do. So, with that in mind, try this:
After the INSERT INTO @temp7 EXEC (rest of your code for the proc)
select * from @temp7 -- verify that data was inserted into @temp7
April 27, 2012 at 1:34 pm
i am doing it already.still not getting anything
Viewing 15 posts - 1 through 15 (of 32 total)
You must be logged in to reply to this topic. Login to reply