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
 urgent help!!

Author  Topic 

pragyapandey9789
Starting Member

6 Posts

Posted - 2014-01-21 : 03:32:46
is this query correct??

merge into stg$kpi_dash s
using (select item_id,default_item,display_order,page_name,english_text,translation_1,nsc_id,dept_order from dual
order by decode(item_id,4096 ,default_item,'Y' ,display_order,10 ,page_name,'MOTORCYCLES SALES' , english_text,'Total Other Income Retail Gross Per Unit',translation_1,'Total Other Income Retail Gross Per Unit' ,nsc_id,3200 ,dept_order,2)
(item_id,10504, default_item,'Y',display_order,11 ,page_name,'MOTORCYCLES SALES',english_text,'Market Exploitation %',translation_1,'Market Exploitation %' ,nsc_id,3200,dept_order,2)
(item_id,1307,default_item,'N' ,display_order,16 ,page_name,'MOTORCYCLES SALES' ,english_text,'Retail Used Bike Stock Turn' , translation_1,'Retail Used Bike Stock Turn',nsc_id,3200,dept_order,2)
(item_id,2030 ,default_item,'Y' ,display_order,7 , page_name,'MOTORCYCLES SALES 2',english_text,'S/HP Series Sales % Sales',translation_1,'S/HP Series Sales % Sales' ,nsc_id,3200,dept_order,3)) i
on (s.item_id=i.item_id)
when matched then
update set s.english_text=i.english_text,s.text=i.translation_1
when not matched then
insert (item_id,default_item,display_order,page_name,english_text,translation_1,nsc_id,dept_order)
values (i.item_id,i.default_item,i.display_order,i.page_name,i.english_text,i.translation_1,i.nsc_id,i.dept_order);

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2014-01-21 : 05:21:14
what is decode? is it a user defined function?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2014-01-21 : 07:44:42
OP re-post from http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=190819


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

Go to Top of Page
   

- Advertisement -