- SELECT EmpID, amount, CASE isnull(StartDate, '') WHEN '' THEN CONVERT(varchar, cast('06/30/2010' AS datetime), 101) ELSE CONVERT(varchar, StartDate,
-
-
101) END AS StartDate, percentage, PayrollCompany, [41] AS Period1, [42] AS Period2
-
-
FROM (SELECT t .EmpID, amount, StartDate, percentage, PayrollCompany
-
-
FROM ESPPPeople e, PeriodInformation p, tmpEmpcontribution t
-
-
WHERE t .EmpID = e.empID AND t .Period *= p.PeriodID) AS p PIVOT(MAX(EmpID) FOR Period IN ([41], [42])) AS pvt
-
-
ORDER BY pvt.EmpID, pvt.Period;
7 1872
Is *= a part of the tsql language? If not, theres your problem, you need to add in some inner and left outer join statements
No even if i remove that condition I 'l get the same message....i get error as "incorrect syntax near PIVOT"
So many errors... - You have *= instead of just =
- You have a lot of spaces between the table qualifier and the field qualifier, i.e. t .fieldname instead of t.fieldname
- You don't return Period as a field in your subquery
- You seem to be trying to create the pivot fields in the select clause when you only have to do so in the pivot clause
the spaces it is taking automatically even if i remove.pivot clause syntax specifies after select clause pivoted fields have to be written ..now am getting confused
In the SELECT clause, you specify the field to be pivoted, not the pivoted fields. You specify the pivoted fields in the PIVOT clause. But you don't even return the field you're trying to pivot so you're trying to pivot on a field that doesn't exist.
Also, *= is the old way of doing a LEFT JOIN. If you remove the asterisk, it will become an INNER JOIN. Try to use the ANSI Standard of doing a join by specifying LEFT or INNER join, whichever case you need it to be.
Happy Coding!!!
~~ CK
hey guys thank u....i ve fixed it .....
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Raphael Gluck |
last post by:
Hi everyone
I have a page on my site in which i wish to display links to brochures, and
i have stored an index of these links in my database.
however when i pass from the master page,...
|
by: Dalan |
last post by:
Please help - just take a quick look at the function code below. It
probably just needs some minor tweaking.
The function module is based on an intermediate query to provide a
group record...
|
by: maneeshkhare |
last post by:
I am trying to update a field in Access db (.mdb) via a DataSet using
the following code. I am continously getting this error:
Has anybody seen this before?
1. If I try using the same code for...
|
by: amitbadgi |
last post by:
I am geting the following error while conv an asp to asp.net
Exception Details: System.Runtime.InteropServices.COMException: Syntax
error in query expression 'id =System.__ComObject'.
Source...
|
by: Roy Rodsson via .NET 247 |
last post by:
Hi all!
I am using a stored procedure in SQL2000 for retrieving fileinformations from a db.
the table as an uniqueidentifier for the file information.
The stored procedure has a variable...
|
by: Tom Baxter |
last post by:
I have a numeric column in a query called Prov1.Volume. When I try
taking the sum of that column (using SUM aggregate function in Design
View) it gives a syntax error. It says that...
|
by: rahuls |
last post by:
Hi everyone, I have a couple of questions?
1.this is part of my main function
//////////////////////////////
int main()
{
FILE *f1;
int i,j;
j=100000000;
int intData;
|
by: veer |
last post by:
Hi
i am running a date query
squery = "Insert into " & txttablename & " IN '" & txtdatabase & " ' select * from " & sTableName & " IN '" & txtfolderpath & "\" & sArrFolder(icount) & "\" &...
|
by: OzNet |
last post by:
Can someone tell me what I am doing wrong here please?
I have a form with two unbound text boxes formatted to short date and an OK button.
My button code is as follows:
Private Sub...
|
by: Yesurbius |
last post by:
I am receiving the following error when attempting to run my query. In my mind - this error should not be happening - its a straight-forward query with a subquery. I am using Access 2003 with all...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
| |