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
 General SQL Server Forums
 New to SQL Server Programming
 Strange Problem in Query

Author  Topic 

SHIVPREET2K1
Starting Member

32 Posts

Posted - 2009-07-03 : 01:56:11
Dear Friend

this is the query i m trying to run on sql server 2005.



insert into my_Temp_Table
(item_code,rm_code,type_of_mat)
select RM_MC_Polish_Cost_of_ITems.Item_code,
RM_MC_Polish_Cost_of_ITems.rm_code,
RM_MC_Polish_Cost_of_ITems.Type_of_Material
from rM_MC_Polish_Cost_of_ITems,Temp_Costing_parameters
where Temp_Costing_parameters.RM_code=RM_MC_Polish_Cost_of_ITems.item_code
and Temp_Costing_parameters.type_of_mat like'Sub%'




The temp_Costing_paremeters.rm_code is equal to RM_MC_Polish_Cost_of_ITems.item_code but still it is not inserting any record in the new table. what could be the reason for this.

thanks in advance

Shivpreet2k1

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2009-07-03 : 02:00:50
Any records return with this query ?

select RM_MC_Polish_Cost_of_ITems.Item_code,
RM_MC_Polish_Cost_of_ITems.rm_code,
RM_MC_Polish_Cost_of_ITems.Type_of_Material
from rM_MC_Polish_Cost_of_ITems,Temp_Costing_parameters
where Temp_Costing_parameters.RM_code=RM_MC_Polish_Cost_of_ITems.item_code
and Temp_Costing_parameters.type_of_mat like'Sub%'


quote:
it is not inserting any record in the new table

Any error messages ?


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

SHIVPREET2K1
Starting Member

32 Posts

Posted - 2009-07-03 : 02:21:33
Yes friend this query do show me data. but its not inserting the data in the other table.

Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2009-07-03 : 02:23:30
quote:
Originally posted by SHIVPREET2K1

Yes friend this query do show me data. but its not inserting the data in the other table.




any error message ? Run the insert query in a Query window and try


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-07-03 : 02:32:47
And if you run into a speed issue, try rewriting

" and Temp_Costing_parameters.type_of_mat like'Sub%' "

as this

" and left(Temp_Costing_parameters.type_of_mat, 3) = 'Sub' "



Microsoft SQL Server MVP

N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-07-05 : 03:18:57
quote:
Originally posted by SHIVPREET2K1

Yes friend this query do show me data. but its not inserting the data in the other table.




are you looking into correct table? what does below select give you

select * from my_Temp_Table
Go to Top of Page
   

- Advertisement -