Similar to pivoting ,but not pivoting
Hi all,
I have a table for example with a name test
SQL> create table test (a number,b number, c number);
Table created.
SQL> insert into test values(1,2,3);
1 row created.
SQL> insert into test values(4,5,6);
1 row created.
SQL> insert into test values(7,8,9);
1 row created.
SQL> commit;
Commit complete.
SQL> select * from test;
A B C
1 2 3
4 5 6
7 8 9i need to create a procedure to do the following this,
it should have the table name as a input parameter
when i pass the table name test , then
it needs to create a new table with name test_attr with the columns row,name,value.
which should come like
test_ATTR
ROW NAME VALUE
1 A 1
1 B 2
1 C 3
2 A 4
2 B 5
2 C 6
3 A 7
3 B 8
3 C 9these values are taken from test table .
Edited by: Mohd Mehraj Hussain on Apr 8, 2010 10:32 AM
Edited by: Mohd Mehraj Hussain on Apr 8, 2010 10:32 AM
Test_new is a with clause that I have added to create a temp table to inlcude rownum. this might explain you better
PRAZY@11gR1> create table test (A number,B number,C number);
Table created.
Elapsed: 00:00:00.01
PRAZY@11gR1> insert into test values(1,2,3);
1 row created.
Elapsed: 00:00:00.00
PRAZY@11gR1> insert into test values(4,5,6);
1 row created.
Elapsed: 00:00:00.00
PRAZY@11gR1> insert into test values(7,8,9);
1 row created.
Elapsed: 00:00:00.00
PRAZY@11gR1> commit;
Commit complete.
Elapsed: 00:00:00.00
PRAZY@11gR1> select * from test;
A B C
1 2 3
4 5 6
7 8 9
Elapsed: 00:00:00.00
PRAZY@11gR1> with TEST_NEW as (select rownum col_row,A,B,C from test)
2 select * from test_new
3 unpivot include nulls (value for col_name in (A,B,C));
COL_ROW C VALUE
1 A 1
1 B 2
1 C 3
2 A 4
2 B 5
2 C 6
3 A 7
3 B 8
3 C 9
9 rows selected.
Elapsed: 00:00:00.01for more info on WITH clause refer
http://morganslibrary.org/reference/with.html
http://www.oracle.com/technology/products/oracle9i/daily/oct10.html
If you believe that your query has been answered, pls close the thread. so that anyone who searches for UNPIVOT would benefit from this. and do change the heading to UNPIVOT in your first post.
Regards,
Prazy
Edited by: Prazy on Apr 8, 2010 11:03 AM
Similar Messages
-
Chapter Marker Problem - Similar to post but not solved
This is my first export since upgrading; in the past all I've ever done was create chapter markers, export to QT and import into DVSPro and poof done. Life is good. Now there are no markers in DVSP. I read a thread about this same problem and it was solved with a right-click to "Add Embedded Markers." That doesn't work for me. The green markers appear in the Timeline & Canvas. I did intentionally put markers into the video & audio tracks themselves so that when I added footage at the front of the sequence I knew where to add markers into the timeline. But, again, there are chapter markers in the Timeline that show in the Canvas. HELP.
EXPORT DIRECTLY THROUGH COMPRESSOR from FCP.
It succks but the quality (especially sync sound) is best. The time is SLOW though!
Oh...don't forget when you lay down your tracks to right click on the time line in DVDSP to "show embedded markers.
I guarantee this will work!!!
Message was edited by: ggree
Message was edited by: ggree -
Dates Appearing in Tabular Model but not appearing on Pivot table
Hi all,
I am using SSAS tabular Model 2012, in tabular model all dates are appearing correct in date column but not when i drag attribute to my pivot table it shows only one date. Does anyone has the solution of this issue.
Regards,
PiyushHi Piyush0308,
According to your description, you have date column displayed all dates correctly in Tabualr. When showing in a Excel Pivot table, it only get the first date. Right?
In this scenario, firstly please check the source table data in database, then make sure the data type of this column is Date in Tabualr. In Excel, please make sure there's no aggregation setting on this field. As I tested in our local environment, it should
display same thing in tabular.
If the issue still persists, please share some information about your date table so that we have some deep analysis.
Best Regards,
Simon Hou
TechNet Community Support -
Coming up in pivot but not in chart
hi everyone ,
i am having one view selctr as taking two cols which is number and the other is %.... when am selecting number it reflects to both pivot and chart below in the report but when i am selecting %(second col) in view selectr, reflects only in pivot but not in chart..,.,. pls help me how to resolve this
Regardshi everyone ,
i am having one view selctr as taking two cols which is number and the other is %.... when am selecting number it reflects to both pivot and chart below in the report but when i am selecting %(second col) in view selectr, reflects only in pivot but not in chart..,.,. pls help me how to resolve this
Regards -
Here goes. My iPod touch has all my songs on it. I have changed computers several times and iTunes has a library of similar but not as many songs as iPod. When I plug iPod in ans go to sync it says that iTunes library will replace iPod songs. I don't want this to happen I want the I pod songs to sync with iTunes. What do I do?
That really does not work since music is not included in the backup. See:
iTunes: About iOS backups
puttly123 wrote:
backup your ipod. then sync your ipod to the computer, then restore your ipod and it will still have the right songs. its exactly what i had to do with mine. -
My iPhone detects my my Belkin G5 series wifi router but not connecting, I searched in internet and found many people have similar experience. Please tell , how can I fix it?.
Try rebooting the router. Just remove the power for a few seconds. No settings are lost.
-
My trackpad is not responding properly on MacBook Pro. Can move the cursor but not click on icons or similar items.
Intel-based Apple Portables: Troubleshooting unresponsive trackpad issues
-
Messages from one of my contacts shows up on my iPhone but not on my iPad. I don't have similar problems with any of my other contacts. Any ideas on how to troubleshoot this?
Does your iPhone and iPad use the same address for Messages?
Using FaceTime http://support.apple.com/kb/ht4319
Troubleshooting FaceTime http://support.apple.com/kb/TS3367
The Complete Guide to FaceTime + iMessage: Setup, Use, and Troubleshooting
http://tinyurl.com/a7odey8
Troubleshooting FaceTime and iMessage activation
http://support.apple.com/kb/TS4268
iOS: FaceTime is 'Unable to verify email because it is in use'
http://support.apple.com/kb/TS3510
Using FaceTime and iMessage behind a firewall
http://support.apple.com/kb/HT4245
iOS: About Messages
http://support.apple.com/kb/HT3529
Set up iMessage
http://www.apple.com/ca/ios/messages/
iOS 6 and OS X Mountain Lion: Link your phone number and Apple ID for use with FaceTime and iMessage
http://support.apple.com/kb/HT5538
How to Set Up & Use iMessage on iPhone, iPad, & iPod touch with iOS
http://osxdaily.com/2011/10/18/set-up-imessage-on-iphone-ipad-ipod-touch-with-io s-5/
Troubleshooting Messages
http://support.apple.com/kb/TS2755
Troubleshooting iMessage Issues: Some Useful Tips You Should Try
http://www.igeeksblog.com/troubleshooting-imessage-issues/
Setting Up Multiple iOS Devices for iMessage and Facetime
http://macmost.com/setting-up-multiple-ios-devices-for-messages-and-facetime.htm l
FaceTime and iMessage not accepting Apple ID password
http://www.ilounge.com/index.php/articles/comments/facetime-and-imessage-not-acc epting-apple-id-password/
Fix Can’t Sign Into FaceTime or iMessage iOS 7
http://ipadtutr.com/fix-login-facetime-imessage-ios-7/
FaceTime, Game Center, Messages: Troubleshooting sign in issues
http://support.apple.com/kb/TS3970
Unable to use FaceTime and iMessage with my apple ID
https://discussions.apple.com/thread/4649373?tstart=90
How to Block Someone on FaceTime
http://www.ehow.com/how_10033185_block-someone-facetime.html
My Facetime Doesn't Ring
https://discussions.apple.com/message/19087457
Send an iMessage as a Text Message Instead with a Quick Tap & Hold
http://osxdaily.com/2012/11/18/send-imessage-as-text-message/
To send messages to non-Apple devices, check out the TextFree app https://itunes.apple.com/us/app/text-free-textfree-sms-real/id399355755?mt=8
How to Send SMS from iPad
http://www.iskysoft.com/apple-ipad/send-sms-from-ipad.html
You can check the status of the FaceTime/iMessage servers at this link.
http://www.apple.com/support/systemstatus/
Cheers, Tom -
SQVI - Join tables using similar fields (but not same)
Hi folks!
I would like to know if there is a way to do a join between two tables thru fields that are similar but not exactly the same. For example, I need to join tables EKKO and CDHDR, where the PO numbers do exist in both the tables (EKKO-EBELN and CDHDR-OBJECTID), but the fields are different. Is it possible to achieve such kind of a join?
Appreciate your help.
Regards,
Anwar.>
Mohammad Anwar wrote:
though their data type is the same (CHAR).
unfortunately it is not enough... You have to select separately from the two tables and merge the data somehow in the program. -
TSQL working in 2008 but not in SQL Server 2014
Hello,
We recently have been asked to move from SQL Server 2008 to SQL Server 2014. We are trying to run parallel tests and one of our queries that was working perfectly in 2008 is not working in 2014.
One of the filter on the our query(from 2008) is we convert a varchar field to date and compare it to anotehr calulated filed ("convert(date,Quick_Data_Start_Date) <= convert(date,(Year_ID_to_Use + '-' + Month_ID_to_Use + '-01'))").
This worked fine in 2008 but when i try to do similar operation in 2014 it returns no result.
For testing purposes, instead of converting the field to date format, i manully converted the actual value i.e. instead of using "convert(date,Quick_Data_Start_Date)" when i use "convert(date,'8/1/2014')" the code works fine.
The field "Quick_Data_Start_Date" comes from a pivot query.
When i create a temporary table for the pivot query and use the temporary table in my code and then convert the field on fly the code works fine again.
Seems like the T sql is not able to convert the field from varchar to date on the fly when coming from a different query. We have tried changing the compatbility level to 100 as well and it still would not work.
Any suggestions and comments will be really helpful. Thanks.
Regards,
GMHello, here is my overall review:
The query is not optimized … agreed! But that’s not the issue.
There are a number of indexes that could be created, a number of minor calculations or evaluation criteria that could be improved to make the query more efficient … again – AGREED.
The query “as is” runs in just under a minute (on SQL 2008 machine with less memory and slower hard drives). Adding the indexes would take more time to add than they would save.
NONE of that should make the query NOT WORK. These deficiencies might make it run more slowly, but should not cause the query to return no results.
“order by” shouldn’t make any difference because the query plan isn’t assuming or using any special order
The main table (~10 M rows) is using a clustered index scan (not efficient, but not the point)
The Time dimension table is using a non-clustered index seek (so the index is sorted but the data in the table is NOT physically sorted that way)
The pivot subquery is using clustered index scan (it’s only 6 rows, so who cares)
Once again, the order by might make it less efficient, but shouldn’t make it fail. We get no errors or warnings – it just returns no rows.
Because the query DOES return results when we
Either dump the Pivot query result into a #temp table(single row) and use the #temp table instead of the pivot query in the big SQL or
The “input” tables are limited to X rows but DOES NOT when the inputs have more rows
This strongly suggests a memory issue.
The server has 64 GB of RAM, but this probably isn’t enough to hold millions of rows and calculations.
Can we turn on some traces to see what’s happening to the data in the query? How and what are we looking for?
Once the memory capacity is exceeded, SQL should be pushing these results to a temporary table (either in the local database or the tempdb). Can we test to see if that is happening?
How?
Is there a permissions issue?
I have successfully done large copies outside of SQL (copied 300+ GB file from one location to another) that had to use the disk instead of just memory … means the disk write operation
isn’t restricted from my user account.
I can also confirm that the account that runs the SQL Service (“Network Service” account) has full permissions to the drives and paths where the mdf and ldf files are stored (including
master and temp).
If this doesn’t work, our upgrade is basically frozen and cannot proceed. I’m really out of ideas … anything? -
Firefox will not open. I get the firefox is already running but not responding window... I have tried rebooting with no help. I have tried to end the process via cntrl+shift+esc and nothing firefox is listed to end. I have tried find the app data via the run icon in the start up window, I have no run icon on this system (Acer with windows vista(?)
== This happened ==
Every time Firefox opened
== The computer was hard shut down and did a improper shut down scan when it was restarted ==
== User Agent ==
Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; FunWebProducts; GTB6.5; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.5.30729; .NET CLR 3.0.30729)I am having a similar problem. Running Xp.
Latest revision of firefox.
After using firefox for a while if I exit, parent.lock is locked and i have to reboot to reload firefox.
I have killed all firefox applications from task manager (usually there are none). and I have tried 3 different "file unlock" programs including unlocker to no avail.
I also recently installed a program that shows -all- open files, and parent.lock is not listed, and thus not closable/unlockable from there. -
IPod nano works with USB 1.1 but not USB 2.0
Anyone using an iPod nano that works with USB 1.1 but not with USB 2.0? I am using Windows XP and when installing the iPod software from CD it recognizes the iPod and am able to transfer songs using iTunes but when installing SP1 or SP2 to enable USB 2.0 transfers, Windows XP only recognizes the iPod nano as a USB Mass Storage Device. This is the same with iPod Updater.
I have a similar problem with the following configuration:
- Dell Dimension 4100 Desktop with 2 integrated USB 1.1 ports, Windows 2000 SP 4
- PCI 6-Ports USB 2.0 Card ("Mentor" resp. www.bona.com.tw), Model USB20-PCI/6P
What works well?
- All my USB add-ons (1.1 and 2.0) on the internal 1.1 ports as well as on the USB2.0 PCI card
- iPod Nano 4GB on internal 1.1 ports (external drive in windows 2000 as well as iPod in iTunes)
- iPod Nano works as well as on the USB 2.0 card ONLY WHEN my old 4-port USB1.1 hub is connected between Nano and USB card
What doesn't works?
My iPod Nano directly connected to the USB 2.0 card. Symptoms when connecting:
- Windows is very slow, process "scvhost.exe" or "system.exe" using 99% of CPU for some minutes
- iPod is recognised as external drive, but when I click on it, it is empty and copying files to it results in "I/O error"
- iTunes doesn't recognise the iPod (of course, if even windows itself cannot read from it...)
I removed all USB drivers, reinstalled iTunes, iPod (by the way, I still don't understand what "iPod update" is good for, except for updating the iPod's firmware), deactivate the internal USB1.1 ports, no result.
Help!!!!!!!!!!!!!!!! -
How can i check for posted but not yet commited changes in a form
Dears
I make changes programmatically in a form then i post it using (Post built in).
If the user exits the form, i make check for any changes in the form to commit it using the system variable :system.form_status
Unfortunately the value of this system variable is 'Query' not 'Changed' because of using the post built in.
Is ther another system variable ( or any another way ) that check for posted but not yet commited changes in the form ?
Thanks a lot
Mostafa AbolaynainI had faced similar situation. Using of package variable which identifies, what is the user's latest action.
This is just a workaround.
Capture what the user has performed into a variable say, PKG_VAR.ACTION,
This will be assigned values like List L, and Create C, Update U and Saved S.
If commit is executed,assing the status S to the variable.
So while closing,
IF :system.form_status = 'CHANGED' or PKG_VAR.ACTION in ('C','U') THEN
-- validate the data, n perform commit.
else
-- just close the form.
end if;
Regards
Deepz : ) -
What is difference between Shared ,Exclusive and Exclusive but not commulat
what is difference between Shared ,Exclusive and Exclusive but not commulative lock modes plese tell me
Lock objects are used to synchronize access to the same data by more than one program.
The lock mode controls whether several users can access data records at the same time. The lock mode can be assigned separately for each table in the lock object. When the lock is set, the corresponding lock entry is stored in the lock table of the system for each table.
There are three types of lock modes
1.Exclusive
2.Shared
3.Exclusive not cummulative
Exclusive lock: The locked data can only be displayed or edited by a single user. A request for another exclusive lock or for a shared lock is rejected.
Shared lock: More than one user can access the locked data at the same time in display mode. A request for another shared lock is accepted, even if it comes from another user. An exclusive lock is rejected.
Exclusive but not cumulative: Exclusive locks can be requested several times from the same transaction and are processed successively. In contrast, exclusive but not cumulative locks can be called only once from the same transaction. All other lock requests are rejected.
please go through these links:
http://help.sap.com/saphelp_nw04/helpdata/en/a2/3547360f2ea61fe10000009b38f839/frameset.htm
http://help.sap.com/saphelp_nw04/helpdata/en/af/22ab01dd0b11d1952000a0c929b3c3/frameset.htm
http://help.sap.com/saphelp_nw04/helpdata/en/cf/21eeb2446011d189700000e8322d00/frameset.htm
http://help.sap.com/saphelp_nw04/helpdata/en/cf/21eebf446011d189700000e8322d00/frameset.htm
http://help.sap.com/saphelp_nw04/helpdata/en/cf/21eed9446011d189700000e8322d00/frameset.htm
briefly :
You can lock the table or record by using following types of locking:
1) Exclusive (E) the locked data can only be displayed or modified by single user i.e the owner of the object. Access to other users is denied.
2) Shared (S) several users can access the same record simultaneously, but only in display mode and except the first one, who has asked for the data in update mode.
3) Exclusive not cumulating (X) it is similar to exclusive lock. It allows only a single user access. E can be called several times from the same transaction. In contrast, a lock type X can be called only once during the transaction. Any other call for this lock is rejected.
Activation of Lock Object
1) When you activate the lock object, the functions are automatically generated. And these are ENQUEUE-EZN and DEQUEUE-EZN. EZN is name of the lock object.
2) While ENQUEUE is used in program to set the code over the selected data depending upon the lock object arguments. DEQUEUE is used to release the lock.
Thanks
Seshu -
i recently updated my itunes...today i opened it up and moticed abuout 100 songs missing...they are now at the bottom of itunes song list with a number next to them with information mission such as this the example below
01 human (this song should have the killers name as artist and cd title, etc)
01 hosanna hillsong united (this song should have the cd title to it)
02 lay me down burning light
02 leave out all the rest
02 let it be the beatles
03 papercut
when i go under the original folders and files in the itunes folder everything is normal no missing info, etc. but under itunes orgnising its picking and choosing the same songs and putting the track number next to it and others songs in the same cd not. plus info missing. under the infor when i click right button all info missing there...but not under original file.
please helpA response on this subject from another post:
It could be that you have inadvertently imported these CDs into iTunes as part of a compilation. If so, the artists won't show in the artists menu on the iPod.
To check, highlight the tracks on one of the offending artists CDs in iTunes, right click and select "get info". This brings up a multiple song info window, and from there you can check if you have 'yes' in the box marked "part of a compilation".
If you have, select 'no' instead and click 'ok'. Do this with any CD that has this issue. This will alter the info in iTunes, and you should then connect your iPod and synchronize the changes.
The problem arises because the information contained on the Gracenote CD Data Base (where iTunes gets all it's album/artist/track info from), is sometimes incorrect. It can show CDs as compilations when in fact they are not.
ramstigo wrote:
I had an earlier post on this subject with a similar problem. I tried what you suggested and it worked indeed. You can select the artists from your Ipod on Itunes and after highlighting the artists/albums affected, click NO on the compilation box and the issue is resolved: the artists appear on the list.
Thank you so much!!!!. -
Apple TV is not showing the authorized computer on my network. All three other Apple devises are sharing. Apple TV is getting my pictures, but not my music or iTunes Match.
It is not properly connected to the network.
Make sure location is set correctly
DNS should be on auto (settings - general - network)
Try ethernet
Signal strength on device won't account for issues, you would need a network report from istumbler, netstumbler or similar. This will show accurate signal strength along with noise and nearby networks
Maybe you are looking for
-
How do I movie an iphoto album onto a memory card.
I need step by step instructions on how to put an iphoto album or pic's from my library onto a memory card for a digital picture frame. Also how to make sure the pics are all the same size and will fit the full frame. I need this asap please, It's fo
-
Inspection lot for rework order
Hi QM Experts, I have a question about the rework order. For the original order i use inspection type 03. After found the defect, i create the rework order using CO07. My question is how to create the inspection lot to check the rework order ? Thanks
-
Trying to sign into iTunes on a new computer.
Trying to sign into iTunes on a new computer. I need to verify by putting in my visa card security code but it wont let me.
-
Dependent Drop-Down Menu in Dreamweaver CS3 and ADDT
Hi All, I have been trying to create a dependent drop--down menu so that when I select an item the corresponding information would populate the other field or fields. So far I have tried to use the tutorial posted on the link below by Waleed Barakat
-
Remove active rows from a filter context
Hey, I have a problem that nags me for a couple of days - My problem is about people (dimSomeOne) who try something (dimThing) on a certain day (dimDate). Each try is finished with a status (dimStatus). It is possible that a distinct person has 1 or