SQL Server 2012 :: Employee Status On First And Last Day Of Pay Period

Mar 26, 2015

I have a requirement in a payroll system to show the status of an employee on the first and last day of each pay period. The pay periods are pretty simple, 24 per year starting on the 1st and 16th of each month. The status effective date, however, can occur on any day, not just the first or last day of the pay period. Here's my DDL.

SET NOCOUNT ON;
declare @EmployeeStatus TABLE (
[EmployeeID] [int] NOT NULL,
[EmployeeStatus] [varchar](24) NOT NULL,
[EffectiveDate] [date] NOT NULL

[Code] .....

View 9 Replies


ADVERTISEMENT

SQL Server 2012 :: Find Trend How Employee Makes Sales Every Month?

Jun 7, 2015

How do I find sales trend of an employee via comparing current month and previous month sales?

I got so far query upto following,

;WITH SalesOrderHeader As
(
SELECT ROW_NUMBER() OVER (ORDER BY SUM(H.SUBTOTAL)) AS ROWNUMBER, SUM(H.SUBTOTAL),H.SALESPERSONID,

[Code]....

I am getting following error:
The ORDER BY clause is invalid in views, inline functions, derived tables, subqueries, and common table expressions, unless TOP, OFFSET or FOR XML is also specified.

View 3 Replies View Related

Generate Single Record That Shows Status Of Accounting Period For Multiple Groups?

Mar 26, 2015

I'm trying to generate a single record that shows the status of an accounting period for multiple groups. For a single accounting period they could all be the same, or all be different (open, closed, hold, etc)

What I want to do is select the accounting period with a group by that says if all the groups are in the same status, then that's the status. But if there are different status' for the period, I just want to have a single line that says 'Mixed' The query below returns 3 records, but I only want 2. I tried a CASE WHEN Having COUNT > 1 but it blew up with an aggregate subquery in a group by error.

DECLARE @AccountingPeriod Table
(AccountingPeriod varchar(10), Status char(1), GroupNum int)
Insert into @AccountingPeriod
Values('2015-03','O',1),
('2015-03','O',2),
('2015-03','O',3),
('2015-02','O',1),
('2015-02','O',2),
('2015-02','C',3)
Select AccountingPeriod, Status from @AccountingPeriod
GROUP BY AccountingPeriod, Status

View 3 Replies View Related

SQL Server 2012 :: Find All Employee Whose Salary Sum Is 80% Of Sum Of Salary Of All Employees

Aug 14, 2014

Let us assume that there are 100 employee in a company. And sum of salary of all employee is 10000. Find list of highest paid employees whose sum of salary is 8000. Remaining employee will fall in 20% bracket.

View 4 Replies View Related

SQL Server 2012 :: Query - Counting Item Occurrence Over A Rolling 72 Hour Period

Jun 18, 2015

I am using MS SQL 2012 and have a pretty simple table dbo. Migration Breakdown with sample data as follows.

DepartDateTime ZoneMovement
2015-06-26 14:00:00.000 6 to 4
2015-06-26 14:00:00.000 11 to 7
2015-06-26 15:30:00.000 9 to 6
2015-06-26 21:00:00.000 7 to 3
2015-06-27 08:01:00.000 7 to 4

[code]....

What I am trying to do is parse the data set to find out when we have more than three like movements ex. 3 to 10 within ANY rolling 72 hour period. I have looked at the SQL Window Functions OVER with a ROW | RANGE subclause, but I can't find out how to tackle this rolling 72 hour business.

View 9 Replies View Related

SQL Server 2012 :: Check Completion Status Of Recovery?

Aug 14, 2015

I have a database In Recovery.

Where do I check the completion status of the recovery?

View 9 Replies View Related

SQL 2012 :: Error 1222 - Lock Request Time Out Period Exceeded

Mar 21, 2013

What is this? How do I fix it? I get a ton of these and it slows down the server for 5 minutes.

An error occurred in Service Broker internal activation while trying to scan the user queue 'msdb.dbo.ExternalMailQueue' for its status. Error: 1222, State: 51. Lock request time out period exceeded. This is an informational message only. No user action is required.

View 1 Replies View Related

Analysis :: How To Create Parallel Period For Multiple Measures In SSAS 2012

Mar 27, 2012

I am trying to create a calculated member for parallel period function using ssas 2012. I have 10 measures for which i need to create parallelperiod. 

I can successfully create for 1 measure but when i add multiple values to it it breaks. Below is the sample i tried for multiple measures:

sum(ParallelPeriod([Date].[Calendar].[year],1,[Date].[Calendar].currentmember) ,
([Measures].[Revenue],[Measures].[Expenses]))

View 10 Replies View Related

SQL 2012 :: Status Of Order Details Per Consumer

Nov 27, 2014

I have a requirement to present computed sales order status value

Parent table : consumer
Child table of consumer : sales order
Child table of sales order: items

Items table has status column with awaiting, accepted , rejected.

Status of the sales order should be set as following
If all items are rejected then sales order status=reject
Or if at least one item is accepted then sales order status = accept
Or if items status is awaiting then sales order status = pend

Query to find all sales order per consumer with computed order status for each sales order.

View 2 Replies View Related

SQL 2012 :: Backup Status In Availability Group

Mar 16, 2015

some of the databases are not backed up in availability groups , they are showing the status as synchronized , how can we check the reason of this ?

View 2 Replies View Related

SQL 2012 :: SSIS - OLEdb Destination Get Success / Failure Status

Feb 19, 2015

I have a SSIS pkg that gets data from SQL and do data conversion and Insert into OLE db AS400 destination, There is a flag column in SQL table , that has to be updated to true, once the records are inserted in AS400 how do i do that in SSIS

SQL oledb ---------> dataConversion ---------------> AS400 OLE db Destination
|
update SQL table Flag column<---------------------------------|

View 9 Replies View Related

DB Engine :: 2012 Database Stuck In Recovery Pending Status?

Jan 12, 2013

I have a SQL cluster which ran out of disk the other day.  I threw plenty more disk at the SAN.  However, 1 of the databases came back with Recovery Pending and has been over 24 hours.  I have tried to backup the database with no success.  I don't have a clean backup from the day it occured so would have a good amount of work missing.

Running a dbcc check returns the following:

Msg 945, Level 14, State 2, Line 1

Database 'sqldb' cannot be opened due to inaccessible files or insufficient memory or disk space.  See the SQL Server errorlog for details.

I have not tried a dbcc check with REPAIR_ALLOW_DATA_LOSS as there seems to be a high risk of losing whatever was going on.  how I can get the db back online?

View 10 Replies View Related

Transact SQL :: Employee Hierarchy In Server

Sep 9, 2015

I want to get the employee hierarchy like tree structure and reportes.

View 7 Replies View Related

Last Period As Initial Value But Still Have Period As Parameter?

Jan 3, 2007

Hi all,

I'm using an olap cube in a report (dash board).
The last "actual" period should be viewed when the user opens the report. I'm using the MDX tail function for that.
Once the report is opened the users want to select another period. Then I want to put period as a parameter.
But that is not possible since the parameter check box is no longer available when using a MDX filter expression.

Is there any solution to this problem?

Any help will be appreciated.

View 34 Replies View Related

SQL 2012 :: Create A Basic Report That Displays UserID / Username / Email / Status?

Sep 24, 2014

I need to create a basic report that displays the userid, username, email, status and need to update the status column to enabled when we select any particular username. And the username parameter comes from the available users from the database. How to do this?

Do I need to mention the where clause where username=@username in the query or we don't need any

Also I need to get the available distinct usernames from the database while entering the parameter username

/*DECLARE variables to use IN queries*/
DECLARE @intErrorCode INT
DECLARE @ErrorMessage VARCHAR(MAX)
DECLARE @UserID INT
SET @ErrorMessage = 'Completed.'
SELECT [userid] ,

[code].....

Basically first I need to find the userid, username, accountstatus, email for a given particular user. Then I need to update the accountstatus to enabled for that selected user.

Also I need to create auditing that from before update and after update the accountstatus.

View 1 Replies View Related

SQL 2012 :: Report GUEST User Access Status In All Databases On Instance Level

Apr 17, 2015

Below query tells us if guest user is enabled or disabled in a particular database

SELECT dp.name, CASE perms.class WHEN 0 THEN 'Yes' ELSE 'No' END AS 'Enabled'
FROM sys.database_principals dp
LEFT JOIN (SELECT grantee_principal_id, class FROM sys.database_permissions
WHERE class = 0 AND type = 'CO' AND state = 'G') AS perms
ON dp.principal_id = perms.grantee_principal_id
WHERE dp.name = 'guest';

Do we have a query which can also add the database name to above query output? The output must have columns with data against Name,Enabled,Database name

View 1 Replies View Related

SQL Server 2014 :: How To Update The Year Employee Has Been In Specific Title

Apr 1, 2014

--===== If the test table already exists, drop it

IF OBJECT_ID('TempDB..#mytable','U') IS NOT NULL
DROP TABLE #mytable

--===== Create the test table with

CREATE TABLE #mytable
(
EMP_ID INT,
Title varchar(50),
DateValue DATETIME,
TITLE_YEAR INT,

[code]....

I am new to this level of coding in SQL SERVER 2012, but I am looking to update the TITLE_YEAR field in the temp table with the Year the employee is in that title. For example for employee 11127 the data should look like this:

EMP_IDTitle DateValue TITLE_YEAR
3 Senior Consultant 2009-01-01 00:00:00.0001
3 Director 2010-01-01 00:00:00.0001
3 Director 2011-01-01 00:00:00.0002
3 Director 2012-01-01 00:00:00.0003
3 Director 2013-01-01 00:00:00.0004
3 Senior Director 2014-01-01 00:00:00.0001

View 6 Replies View Related

Timeout Period In SQL Server 2005

Nov 24, 2005

How do you set the "Timeout Period" in SQL Server 2005?

View 1 Replies View Related

SQL SERVER STOPPED AFTER EVALUATION PERIOD

Feb 15, 2008

Hi,

I have inherited a nice problem when starting a new role.

My SQL server has stopped and i get the 17051 error when i try to start the services, It is the evaluation copy. I do have a registered full copy on another box.

I really want to keep some of the databases i have been using in the test environment. They have not been backing up as the msdb DB became corrupt some time ago.

Is there any way i can get them moved to my other box.

CAn i reinstall SQL server (another eval copy) onto the duff box (keeping the db's) back them up and then move them

in a pickle

Cheers

Allan.

View 5 Replies View Related

SQL Server Evaluation Period Has Expired??!

Aug 15, 2006

Hi,

Today my SQL Server Express suddenly stopped working. After a few hours troubleshooting I finaly found something in the Event Viewer/Application Errors: SQL Server evaluation period has expired...Isn´t the express edition supposed to be free?.

By the way: Windows did 27 automatic updates just before this happened. Might have something to do with it.

Is there a easy way to deal with this or do I have to reinstall and just hoping that I can restore my database?

Most greateful for any answers!

Johan

View 8 Replies View Related

Connection To Sql Server Being Lost After A Period Of Inactivity

Oct 17, 2007

I updated my SQL Server 2005 db server with Windows 2003 SP2 and other windows updates and now other applications are loosing their connections to the SQL server after a period of inactivity.

The ERP software and MSSS Managment Studio loose their connections if the connection sits idle for a couple of hours. When in Management Studio I get the following error:
Msg 10054, Level 20, State 0, Line 0 A transport-level error has occurred when sending the request to the server. (provider: TCP Provider, error: 0 - An existing connection was forcibly closed by the remote host.)....

Has anyone seen this? Do I need to add SP1 for MS SQL 2005?

Thanks-Dave

View 24 Replies View Related

SQL Server 2005 Evaluation Version Period Ended

Apr 10, 2008

HI All,

WE were using SQL Server 2005 Evaluation Edition having one user database created for application testing and also using reporting services for dashboard purposes.

Now our Evaluation period ended However we have already purchased SQL Server 2005 standard license for actual implimentation.

Can anyone guide me step by step how to seamlessly upgrade from evaluation version to the license version of SQL Server 2005 standard.

its somewhat urgent so i request quick help on this

Thanks in advance.

View 3 Replies View Related

SQL Server Admin 2014 :: Deleting Job History For Particular Time Period

Feb 8, 2015

How to delete the job history for particular runs.

Suppose if a job run 3 times/day. I want to keep the oldest information and delete the recent 2 runs history.

View 5 Replies View Related

SQL Server Admin 2014 :: Deny Access To AD Login For Certain Period Of Time

Apr 23, 2015

SQL server job or SP to deny access to an AD login for certain period of time to SQL server instance...i.e. to deny access to login ADxyz from 12 PM to 10 PM and revoke access to same login at 10:01 PM...

View 3 Replies View Related

SQL Server 2008 :: Query To Looking For Cases Of Period Difference In Legal Names

Jun 9, 2015

How to write a Query for multiple legal names that have the same CARE Number (same address) with difference of one Legal Name having a period in the name versus the other legal name that doesn't.

For example: Looking for cases of two of the same legal name one set off by period

All Season Equipment Ltd.
All Season Equipment Ltd

West End Housing, Inc.
West End Housing, Inc

Wellings, Norman L.
Wellings, Norman L

North Texas Boats, LLC
North Texas Boats, L.L.C.

Oktibbeha County Cooperative (A.A.L.)
Oktibbeha County Cooperative (AAL)

S & R Turf & Irrigation Equipment, L.L.C
S & R Turf & Irrigation Equipment, L.L.C.

Burke Equipment Company; Burke Equipment-Seaford, Inc.; Newark Kubota, Inc.
Burke Equipment Company
Burke Equipment-Seaford, Inc.

Pleasant Valley Outdoor Power, L.L.C.
Pleasant Valley Outdoor Power, LLC

J & D Lawn and Tractor Sales, Inc.
J&D Lawn & Tractor Sales, Inc"

View 2 Replies View Related

SQL Server Admin 2014 :: Timeout Period Elapsed Prior To Completion Of Operation

Jul 28, 2014

I am currently running SQL 2014 in my production environment. Both machines are configured for Windows Failover Cluster Services so that we could take advantage of AlwaysOn Availability Groups.

Currently we are experiencing a issue where our web application is throwing an error, "Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding." I am pretty sure that the error is being thrown from the application, but I can't prove it. Because the error states it is SQL, the consensus seems to be that SQL is having the issue. I need to know how to troubleshoot it to ensure that SQL is not the problem.

View 9 Replies View Related

SQL Server&#39;s Status

Jul 9, 2001

Hello,

Can anyone guide me to monitor whether Production Sql server is up and running and would e-mail or page me if by chance it has stopped.

Any help is appreciated.

Thanks.

Priti

View 5 Replies View Related

Server Status

Jun 3, 2008

Hi Gurus,

While iam connecting to servers through management studio iam facing
iam seeing like few servers are connected with Green colour (like>)and few are connected with circle as white.Frm these how can i decide the server status.

Is there any comand to view server status ?


Thanks,
ServerTeam

View 3 Replies View Related

Server Status

Jun 6, 2006

This probably isn€™t a T-SQL question but couldn€™t find an appropriate place in the forum for it.

I€™m building a statistics page for our customers and i want to show how long the SQL server has been up since the last restart, I€™ve got the windows uptime from elsewhere but wondering if there€™s a way to get the SQL Server uptime.



Thanks
Chris
Dwebs Ltd

View 4 Replies View Related

TOP 1 For Each Employee

Jul 19, 2013

I need to select last order for each employees for homework. I use northwind database for testing. I can solve it by correlated subquery but the professor said me it is not optimized.

select orderid, customerid, employeeid, orderdate
from orders as o1
where orderdate = (select max(orderdate) from orders as o2 where o1.employeeid = o2.employeeid);

View 6 Replies View Related

Report Server Status 403

Feb 21, 2007

I'm trying to
get reports and report server site aveable through user certificate.

Web site is
under default web site. Under default web site is certificate server web page,
it is aveable and configured the same way and it works if I use certificate.



If I type https://FQDN/Reports
, i get error The request failed with HTTP status 403: Forbidden. But if I type
https://FQDN/reportserver i can access.

Both sites are
aveable if I use only https. But if I but if i use Require client certificate,
than I get 403 error.



In rsreportserver.config,
there is <UrlRoot>https://NETBIOSServerName/reportserver</UrlRoot>,
does not help if I use FQDN.



If I enable anonymous
access, I can not access Reports site, an I get error 403, but on Reportserver
site I get following error :



Reporting
Services Error

--------------------------------------------------------------------------------



The permissions
granted to user 'MSVEPOIUSR_WEPO-DC' are insufficient for performing this
operation. (rsAccessDenied) Get Online Help



--------------------------------------------------------------------------------

SQL Server
Reporting Services



SQL is 2005 SP1
, and OS is Windows server 2003 SP1

View 1 Replies View Related

SQL Server Procedure Execution Status

Feb 18, 2008

I am running a SQL Server procedure from ADO in visual C++, sometimes I get return -6 as return code from procedure.

From SQL Server documentation:

"SQL Server currently uses return values 0 through -14 to indicate the execution status of stored procedures. Values from -15 through -99 are reserved for future use."

I cannot find a description for the returns codes from SQL Server for error conditions (from -1 to -14), does anyone here knows where can I find this information?

Best regards,

Pedro Chau

View 1 Replies View Related

Checking Linked Server Status

Oct 26, 2007

Is there a quick way to determine linked server availability. I've got some select statements wrapped up in TRY/Catch blocks which will re-direct any failures to retreive data from a linked server to the catch block and I can get my data from elsewhere, but I have to wait for the statement to fail before I can jump into the catch block. I hoped to speed the process up by using an if exists check on the status of the linked server . Is there such a thing as a quick check on whether or not a linked server is online?

THX

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved