In my stored procedure I am trying to insert records in to a temporary table
In my stored procedure I am trying to insert records in to a temporary table
--Temporary table
create table #CR_TMP
(
ct_co_id int NULL
, ct_nbr int NULL
, ctrct_srvc_type char(4) NULL
, start_date datetime NULL
, end_date datetime NULL
)
print 'Before insert'
Insert into #CR_TMP
select distinct col1,col2,......
from tableName
where conditions
print 'After insert'
select '#CR_TMP' as #CR_TMP, * from #CR_TMP
print 'here 1'
I ran the select query and it gives about 583 rows.
But when I execute the above procedure. I think it’s getting stuck on the insert procedure.
I do get the result ‘After insert’ but I don’t get the results for print ‘here 1’.
I had this procedure executing for 2 hours and it was stuck at the same place. Any pointers here?
I ran the select query and it gives about 583 rows.
But when I execute the above procedure. I think it’s getting stuck on the insert procedure.
I do get the result ‘After insert’ but I don’t get the results for print ‘here 1’.
I had this procedure executing for 2 hours and it was stuck at the same place. Any pointers here?
The procedure looks good except for this part:
Try changing this to:
Or even remove the first part of the
selectEdit:
After a discussion in chat, it was determined that the initial portion of the stored procedure that sanika thought was the issue actually was working. So I advised that they start working query by query back into a test to determine where the actual problem is. At that point, it will be easier to debug a 30 page stored procedure.