I am trying to create a query that numbers my rows and the change of empid, it starts over.. I was looking at some blog on Row_number() but cannot seem to get it to work. Below is my current query, any suggestions would be greatly appreciated!!
EXECUTE adm_Supplimental
SELECT
row_number()...
I have a list of id's that I derived by creating a temp table. From that list I need to get a count by region for each month from Jan. 2009 - Dec. 2010. I am struggling getting this to work? Here is the start of my code:
Create table totalemp# (empid int,geo nvarchar(50))
EXECUTE...
Could someone please help me out? I have an update statement that I am trying to do and it keeps giving me this error:
Msg 156, Level 15, State 1, Line 3
Incorrect syntax near the keyword 'CONVERT'.???
I have no clue what I am doing wrong..
Here is my code:
UPDATE ystdy_PA0000
SET...
Could someone please help me figure out how to convert the below data:
'19731214' is how the date is printed from the database.
I have tried:
1. CONVERT(varchar, CONVERT(datetime, CONVERT(nvarchar, DecryptByKey(a.[Birth Day])), 101), 101)
But it returns the "Arithmetic overflow..." error...
I have a case statment with similar criteria's in them:
Case when role = '8020' and id in (select id from exec) then 'Exec Bonus'
when role = '8020' and not id in (select id from exec) then 'Monetary'
Else '' end.
What is happening is the ones that are not in "exec" are coming back blank...
I have the below data and want to get the max date with all corresponding data:
sapid startdate number cstctr job
500032 02/10/2010 30001450 AR01000008 10000549
500032 04/01/2009 39000345 AR01000003 10000549
500032 09/16/2009 30001380 AR01000003 10000549
500032 09/29/2008 39000345 AR01000003...
I have a project where I need to pull back data based on 2 criterias:
1. Has more than one value in the table
2. At least one of those values fall within the range of
9/27/10-10/25/10.
I have it to where it pulls "1", but now I am struggling with getting it to only pull back "2". The...
What am I doing wrong in the below statement:
CASE
WHEN NOT CAST(CONVERT(nvarchar, DecryptByKey(a.[1003-Ref Salary])) as MONEY) > 0 THEN NULL
WHEN NOT c.Name IS NULL THEN (a.[PP salary-Comm] * CAST(y.[Annual Conversion] as money))
ELSE (CAST(CONVERT(nvarchar, DecryptByKey(a.[1003-Ref...
I have a table that a set of data from 2 sources. The difference is the employeeid has letters in the front when coming from table b:
employee id [Pay Group ID]
WD506197 US01
506197 USA-1
Below is the code I have so far, but I am not sure how to distinguish the tables and if this...
Is there anyway to correctly write a SQL statement for a case statment within a case statement? Below is what I have and it is not working:
'Task' =
CASE WHEN
(
CASE
WHEN NOT ia.[EmployeeGroup] IS NULL THEN ia.[EmployeeGroup]
ELSE ec.[Employee Type]
END) = 'Contractor' then...
I have the below code:
DATEADD(DAY,-1,CONVERT(nvarchar, DecryptBykey([last day of work])))
and it is giving me the below error:
Conversion failed when converting datetime from character string.
I have tried everything I know how, please help!!
Thanks,
Is there a way to tell SQL to get the max(ID) and add "1" to it where the value is NULL? But what I need is if there is more than one NULL value increase in increments of "1".
Is there an easy way to accomplish this? Sample data is below. Column "A" has the NULL value in it. We couldn't make...
I have a query that at times may have 2 rows with the same ID, but only one of those rows needs to be returned based on the date stamp on the file (only when there are multiple rows with the same id). Below is sample data:
A B C D E F G H I J K L M N O
2741 501304 Joe Spellman 32.38 % Monthly...
I have a file that I will be importing into the database as updates are being made. The issue is the column "action" is as follows:
1,4,10 etc and when I join to "reasons" table the columns is as follows:
01, 04, 10 so therefore I am not picking up the value from the action table becasue the...
I have a table called "PersonalData".
There are 3 fields:
FirstName, LastName, Salary..
I need to add an index key to the table in order to make the query I am using work. How to I go about adding "ID" as a primary key and making it an index so that it auto-generates the number (1,2,3,4...
I am trying to pass a tablename as a parameter. Below is the code I have and it is giving me an error
CREATE PROCEDURE [dbo].[pcs_DeleteOldPAFiles]
@upltable nvarchar(50)
AS
BEGIN
Declare @startdate datetime
SET @startdate = CONVERT(nvarchar, getdate(), 101)
Delete * from @upltable
Where...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.