[SQL 2012] Count and Sum over the some table |
- Count and Sum over the some table
- Table data in tabular form
- Problem with agent service accounts?
- Create Asymmetric key from executable file
Count and Sum over the some table Posted: 19 Aug 2013 03:43 AM PDT Hi allSuppose we have a table DATHIS with the following information:[X1]---------[X2]-[X3]2013-08-10, 1250, 75.02013-08-10, 1251, 82.02013-08-10, 1252, 35.02013-08-10, 1253, 45.02013-08-11, 1250, 75.12013-08-11, 1251, 82.22013-08-11, 1252, 50.32013-08-11, 1253, 50.42013-08-12, 1250, 75.52013-08-12, 1251, 82.62013-08-12, 1252, 45.72013-08-12, 1253, 55.8We need the output like this:[Y1]--------[Y2]--[Y3]-[Y4]2013-08-10, 75.0, 82.0, 02013-08-11, 75.1, 82.2, 22013-08-12, 75.5, 82.6, 1On Y4 column we need to count the number of X2 IN (1252, 1253) >= 50. We did the following SQL command for Y1, Y2 and Y3:SELECT X1 Y1, [1250] Y2, [1251] Y3 FROM(SELECT X1, X2, X3 FROM DATHIS WHERE X1>='2013-08-10') H PIVOT ( SUM(X3) FOR X2 in ([1250], [1251]) ) AS DHORDER BY X1But, now how can we include Y4, for counting of number of rows >= 50.0 for X2 IN (1252, 1253)?Any one have an idea for that, please?Best RegardsPaulo:hehe: :crazy: |
Posted: 05 Aug 2013 10:20 PM PDT CREATE TABLE [dbo].[LeaveEntry]( [LeaveId] [int] IDENTITY(1,1) NOT NULL, [Name] [varchar](50) NOT NULL, [LeaveTypeName] [int] NOT NULL, [StartDate] [datetime] NULL, [EndDate] [datetime] NULL, )INSERT INTO LeaveEntry VALUES (1, 'A','OUT','2013-08-29 00:00:00.000','2013-09-29 00:00:00.000'), (2, 'B','LON','2013-08-29 00:00:00.000','2013-09-29 00:00:00.000'), (3, 'C','OUT','2013-08-29 00:00:00.000','2013-09-29 00:00:00.000'); I want to do a report in ssis where I have to send an email i a tabular form for each weeksomething likeWeek 1<table border="1px"><tr><td></td><td>A</td> <td>B</td> <td>C</td> </tr><td>Monday</td><td>OUT</td><td>LON</td><td></td></tr><tr><td>Tuesday</td><td></td><td></td><td>LON</td></tr><tr><td>Wednesday</td><td>OUt</td><td></td><td>LON</td></tr><tr><td>Thurday</td><td></td><td></td><td></td></tr><tr><td>Friday</td><td></td><td>OUT</td><td></td></tr></table> Week 2<table border="1px"><tr><td></td><td>A</td> <td>B</td> <td>C</td> </tr><td>Monday</td><td>OUT</td><td>LON</td><td></td></tr><tr><td>Tuesday</td><td></td><td></td><td>LON</td></tr><tr><td>Wednesday</td><td>OUt</td><td></td><td>LON</td></tr><tr><td>Thurday</td><td></td><td></td><td></td></tr><tr><td>Friday</td><td></td><td>OUT</td><td></td></tr></table> |
Problem with agent service accounts? Posted: 06 Aug 2013 07:33 AM PDT Hey guys. Ive never had this problem with SQL2008 /R2. But I cant get the SQL Agent to log in with anything but local system or a local user that has admin rights on the server. Generally, I would make a SQL_svc_agent_user and grant no rights and and using the sql installer it would grant any permissions including log on a service and add NT SERVICE\SQLSERVERAGENT as SA. Now even with all that in place this user cannot log on in 2012. Even if I granted SQL_svc_agent_user SA rights in Management Studio this still does not work. Seems like something changed in 2012? What am i missing here? The service account for SQL runs just fine but not the agent. This is a local account, but the machine is connected to a domain. Its driving me nuts!:hehe: |
Create Asymmetric key from executable file Posted: 19 Aug 2013 07:01 AM PDT Sorry Admins - Please delete this thread, shouldnt have posted without doing proper research. |
You are subscribed to email updates from SQLServerCentral / SQL Server 2012 / SQL 2012 - General To stop receiving these emails, you may unsubscribe now. | Email delivery powered by Google |
Google Inc., 20 West Kinzie, Chicago IL USA 60610 |
No comments:
Post a Comment