Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Common Table expression error:Msg 4104, Level 16,

Author  Topic 

last
Starting Member

25 Posts

Posted - 2009-03-23 : 08:28:56
Hi All

I have the folowing query which parses succefully but when executing it i get the following errors:
Msg 4104, Level 16, State 1, Line 1
The multi-part identifier "P1.NUMBER" could not be bound.
Msg 4104, Level 16, State 1, Line 1
The multi-part identifier "P1.NUMBER" could not be bound.
My query is

WITH CTE AS
(
SELECT ROW_NUMBER() OVER (PARTITION BY P1.Category ORDER BY P1.Category) AS 'RowNo',
P1.NUMBER,P1.OPEN_TIME, P1.CONTACT_NAME, P1.CATEGORY,P1.SUBCATEGORY
FROM PROBSUMMARYM1 P1
JOIN PROBSUMMARYM2 P2 On P1.NUMBER=P2.NUMBER
)
SELECT
P1.NUMBER,OPEN_TIME, CONTACT_NAME, CATEGORY,SUBCATEGORY
FROM CTE
JOIN PROBSUMMARYM2 P2 On P1.NUMBER=P2.NUMBER
WHERE RowNo >= 10

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2009-03-23 : 08:34:31
FROM CTE as P1

Webfred


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

last
Starting Member

25 Posts

Posted - 2009-03-23 : 08:56:11
Thank you webfred. That solved the issue.
Go to Top of Page
   

- Advertisement -