Showing posts with label status. Show all posts
Showing posts with label status. Show all posts

Monday, March 26, 2012

Problem with Sql Query

By Running a query, I got the result set as shown below

Month Status Count
===== ====== =====
April I 129
April O 4689
April S 6
July I 131
July O 4838
July S 8
June I 131
June O 4837
June S 8
May I 131
May O 4761
May S 7

But, I need the same result set as below and no. of rows for Status is unknown. it may be more than three like (I, O, S, T, W and so on), so dynamically the there will be more columns.


Month I O S
===== = = =
April 129 4689 6
July 131 4838 8
June 131 4837 8
May 131 4761 7

Can anyone provide me the tips/solution.

Thanks in advance

RG

Reminds me of the Cross-Tab queries in MS-Access.

Check -

http://www.stephenforte.net/owdasblog/PermaLink.aspx?guid=2b0532fc-4318-4ac0-a405-15d6d813eeb8

http://support.microsoft.com/default.aspx?scid=kb;EN-US;q175574

'Almost' dynamic column generation.

|||I believe the new pivot functionality in sql server 2005/ express will do that for ya.sql

Problem with SQL (Job cannot run, Job status not updated)

Hi All,

I would need your help please.

I just installed a new fresh SQL server under Windows 2000 Advanced server SP 4

1. Firstly i tried to run normal database backup to a folder by select backup database then run manually and it ran very well. Then i tried to run it with schedule as sql backup job to the same folder. After the job was showed in the sql jobs list, i tried to run it manually by clicking start job. When i refresh the screen under the status field it says "executing job step '0 (unknown)" then in about 5 seconds the status turned into "not running". And i cannot find any error in the log and in the last run job status. The SQLSERVERAGENT is running, the strange thing is another job which is only to update the database can run with the scheduler very well.

2. Whenever i run job then after it finished the last run job status is always unknown.

What will be the solution for the conditions above, please help Sad(

Thank you very much in advance

Best Regards

Felix

Just restart the sql server agent and see......may be the agent might have been in hanged state.........but i am not sure about it.....|||

Hi deepak,

Thank you very much

I can only try the solution tomorrow morning, just to make sure.

I have tried to run another jobs which is not backup job by using sqlserveragent as well and its working well.

So with this information perhaps you have other opinition please let me know.

I will let you know how it goes tomorrow morning, wish me luck Smile

many thanks

Felix

sql