June 6, 2022 at 5:19 pm
Hello!
Please, consider the following simple code
with cte AS (
SELECT
[cntSRVLDAPLOADAVERAGE]
FROM [watchdocstats].[dbo].[servercounters]);
WITH cteCORE AS ( SELECT * FROM cte );
SELECT * FROM cteCORE
Would someone please elaborate on why I get 'Incorrent syntax near ;' error?
June 6, 2022 at 5:33 pm
found the answer
https://stackoverflow.com/questions/18010850/sql-with-clause-within-a-with-clause
Happy coding!
June 6, 2022 at 5:50 pm
found the answer
https://stackoverflow.com/questions/18010850/sql-with-clause-within-a-with-clause
Happy coding!
Can you post the solution for the code you posted?
--Jeff Moden
Change is inevitable... Change for the better is not.
June 6, 2022 at 9:31 pm
Getting carried away with the semicolons, and attempting to use two WITHs for one SELECT:
:WITH cte AS (
SELECT [cntSRVLDAPLOADAVERAGE]
FROM [watchdocstats].[dbo].[servercounters]
),
cteCORE AS ( SELECT * FROM cte
)
SELECT *
FROM cteCORE
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
June 6, 2022 at 10:21 pm
Exactly! there's no way to nest 'with', but one can chain them.
Thank you!
June 7, 2022 at 8:38 am
This was removed by the editor as SPAM
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply